Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add warning while enabling email verification

Neeraj Gupta9ba6bf04e425
diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb
index 713c316e12..57bc8ca003 100644
--- a/lib/l10n/arb/app_en.arb
+++ b/lib/l10n/arb/app_en.arb
@@ -92,6 +92,7 @@
"importCodeDelimiterInfo": "The codes can be separated by a comma or a new line",
"selectFile": "Select file",
"emailVerificationToggle": "Email verification",
+ "emailVerificationEnableWarning": "If you are storing the 2FA to your email with us, turning on email verification could result in a deadlock. If you are locked out of one service, you might not be able to log in to the other.",
"authToChangeEmailVerificationSetting": "Please authenticate to change email verification",
"authToViewYourRecoveryKey": "Please authenticate to view your recovery key",
"authToChangeYourEmail": "Please authenticate to change your email",
diff --git a/lib/ui/settings/security_section_widget.dart b/lib/ui/settings/security_section_widget.dart
index b228ef512e..aa05dd62b6 100644
--- a/lib/ui/settings/security_section_widget.dart
+++ b/lib/ui/settings/security_section_widget.dart
@@ -179,7 +179,7 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
);
}
- Future<void> updateEmailMFA(bool isEnabled) async {
+ Future<void> updateEmailMFA(bool enableEmailMFA) async {
try {
final UserDetails details =
await UserService.instance.getUserDetailsV2(memoryCount: false);
@@ -195,7 +195,21 @@ class _SecuritySectionWidgetState extends State<SecuritySectionWidget> {
),
);
}
- await UserService.instance.updateEmailMFA(isEnabled);
+ if (enableEmailMFA) {
+ await showChoiceActionSheet(
+ context,
+ title: context.l10n.warning,
+ body: context.l10n.emailVerificationEnableWarning,
+ isCritical: true,
+ firstButtonOnTap: () async {
+ await UserService.instance.updateEmailMFA(enableEmailMFA);
+ },
+ secondButtonLabel: context.l10n.cancel,
+ firstButtonLabel: context.l10n.iUnderStand,
+ );
+ } else {
+ await UserService.instance.updateEmailMFA(enableEmailMFA);
+ }
} catch (e) {
showToast(context, context.l10n.somethingWentWrongMessage);
}