Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add device auth for sign in to backup action (#361)

Neeraj Guptaf04d9b94d985
diff --git a/lib/l10n/arb/app_en.arb b/lib/l10n/arb/app_en.arb
index 968eb430d4..eeb4e81b0e 100644
--- a/lib/l10n/arb/app_en.arb
+++ b/lib/l10n/arb/app_en.arb
@@ -100,6 +100,7 @@
"authToChangeYourEmail": "Please authenticate to change your email",
"authToChangeYourPassword": "Please authenticate to change your password",
"authToViewSecrets": "Please authenticate to view your secrets",
+ "authToInitiateSignIn": "Please authenticate to initiate sign in for backup.",
"ok": "Ok",
"cancel": "Cancel",
"yes": "Yes",
diff --git a/lib/ui/settings_page.dart b/lib/ui/settings_page.dart
index e0035360db..e5df8fcc31 100644
--- a/lib/ui/settings_page.dart
+++ b/lib/ui/settings_page.dart
@@ -3,7 +3,9 @@ import 'dart:io';
import 'package:ente_auth/core/configuration.dart';
import 'package:ente_auth/l10n/l10n.dart';
import 'package:ente_auth/onboarding/view/onboarding_page.dart';
+import 'package:ente_auth/services/local_authentication_service.dart';
import 'package:ente_auth/services/user_service.dart';
+import 'package:ente_auth/store/code_store.dart';
import 'package:ente_auth/theme/colors.dart';
import 'package:ente_auth/theme/ente_theme.dart';
import 'package:ente_auth/ui/components/buttons/button_widget.dart';
@@ -99,6 +101,19 @@ class SettingsPage extends StatelessWidget {
await handleExportClick(context);
} else {
if (result.action == ButtonAction.second) {
+ bool hasCodes =
+ (await CodeStore.instance.getAllCodes()).isNotEmpty;
+ if (hasCodes) {
+ final hasAuthenticated = await LocalAuthenticationService
+ .instance
+ .requestLocalAuthentication(
+ context,
+ context.l10n.authToInitiateSignIn,
+ );
+ if (!hasAuthenticated) {
+ return;
+ }
+ }
await routeToPage(
context,
const OnboardingPage(),