TF-2928 Handle bad credential exception
This commit is contained in:
@@ -19,6 +19,7 @@ import 'package:fcm/model/firebase_capability.dart';
|
|||||||
import 'package:fcm/model/firebase_registration_id.dart';
|
import 'package:fcm/model/firebase_registration_id.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:forward/forward/capability_forward.dart';
|
import 'package:forward/forward/capability_forward.dart';
|
||||||
import 'package:get/get.dart';
|
import 'package:get/get.dart';
|
||||||
import 'package:jmap_dart_client/jmap/account_id.dart';
|
import 'package:jmap_dart_client/jmap/account_id.dart';
|
||||||
@@ -96,12 +97,10 @@ abstract class BaseController extends GetxController
|
|||||||
FpsCallback? fpsCallback;
|
FpsCallback? fpsCallback;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onReady() {
|
||||||
super.onInit();
|
super.onReady();
|
||||||
if (PlatformInfo.isWeb) {
|
if (PlatformInfo.isWeb) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
_triggerBrowserReloadListener();
|
||||||
_triggerBrowserReloadListener();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -190,7 +189,7 @@ abstract class BaseController extends GetxController
|
|||||||
if (exception is ConnectionError) {
|
if (exception is ConnectionError) {
|
||||||
_handleConnectionErrorException();
|
_handleConnectionErrorException();
|
||||||
} else if (exception is BadCredentialsException) {
|
} else if (exception is BadCredentialsException) {
|
||||||
_executeBeforeUnloadAndLogOut();
|
_handleBadCredentialsException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +200,7 @@ abstract class BaseController extends GetxController
|
|||||||
} else if (exception is ConnectionError) {
|
} else if (exception is ConnectionError) {
|
||||||
_handleConnectionErrorException();
|
_handleConnectionErrorException();
|
||||||
} else if (exception is BadCredentialsException) {
|
} else if (exception is BadCredentialsException) {
|
||||||
_executeBeforeUnloadAndLogOut();
|
_handleBadCredentialsException();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,6 +231,28 @@ abstract class BaseController extends GetxController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _handleBadCredentialsException() {
|
||||||
|
if (PlatformInfo.isWeb) {
|
||||||
|
if (currentContext == null) {
|
||||||
|
_executeBeforeUnloadAndLogOut();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
showConfirmDialogAction(
|
||||||
|
currentContext!,
|
||||||
|
AppLocalizations.of(currentContext!).dialogMessageSessionHasExpired,
|
||||||
|
AppLocalizations.of(currentContext!).reconnect,
|
||||||
|
title: AppLocalizations.of(currentContext!).sessionExpired,
|
||||||
|
alignCenter: true,
|
||||||
|
outsideDismissible: false,
|
||||||
|
icon: SvgPicture.asset(imagePaths.icTMailLogo, width: 64, height: 64),
|
||||||
|
paddingButton: const EdgeInsets.symmetric(horizontal: 8, vertical: 16),
|
||||||
|
onConfirmAction: _executeBeforeUnloadAndLogOut);
|
||||||
|
} else if (PlatformInfo.isMobile) {
|
||||||
|
clearDataAndGoToLoginPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void handleFailureViewState(Failure failure) async {
|
void handleFailureViewState(Failure failure) async {
|
||||||
logError('$runtimeType::handleFailureViewState():Failure = $failure');
|
logError('$runtimeType::handleFailureViewState():Failure = $failure');
|
||||||
if (failure is LogoutOidcFailure) {
|
if (failure is LogoutOidcFailure) {
|
||||||
|
|||||||
@@ -212,9 +212,6 @@ class ComposerController extends BaseController with DragDropFileMixin implement
|
|||||||
void onInit() {
|
void onInit() {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
if (PlatformInfo.isWeb) {
|
if (PlatformInfo.isWeb) {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
||||||
_triggerBrowserEventListener();
|
|
||||||
});
|
|
||||||
richTextWebController = getBinding<RichTextWebController>();
|
richTextWebController = getBinding<RichTextWebController>();
|
||||||
} else {
|
} else {
|
||||||
richTextMobileTabletController = getBinding<RichTextMobileTabletController>();
|
richTextMobileTabletController = getBinding<RichTextMobileTabletController>();
|
||||||
@@ -228,6 +225,9 @@ class ComposerController extends BaseController with DragDropFileMixin implement
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void onReady() {
|
void onReady() {
|
||||||
|
if (PlatformInfo.isWeb) {
|
||||||
|
_triggerBrowserEventListener();
|
||||||
|
}
|
||||||
_initEmail();
|
_initEmail();
|
||||||
if (PlatformInfo.isMobile) {
|
if (PlatformInfo.isMobile) {
|
||||||
Future.delayed(const Duration(milliseconds: 500), _checkContactPermission);
|
Future.delayed(const Duration(milliseconds: 500), _checkContactPermission);
|
||||||
|
|||||||
Reference in New Issue
Block a user