π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
require authentication before updating backup password
Prateek Sunal6724de31c3c3
diff --git a/mobile/apps/auth/ios/Podfile.lock b/mobile/apps/auth/ios/Podfile.lockindex e2b6f87b13..9fcf20b48e 100644--- a/mobile/apps/auth/ios/Podfile.lock+++ b/mobile/apps/auth/ios/Podfile.lock@@ -258,7 +258,7 @@ SPEC CHECKSUMS:flutter_local_authentication: 989278c681612f1ee0e36019e149137f114b9d7fflutter_local_notifications: 395056b3175ba4f08480a7c5de30cd36d69827e4flutter_native_splash: c32d145d68aeda5502d5f543ee38c192065986cf- flutter_secure_storage: 1ed9476fba7e7a782b22888f956cce43e2c62f13+ flutter_secure_storage: 2c2ff13db9e0a5647389bff88b0ecac56e3f3418fluttertoast: 2c67e14dce98bbdb200df9e1acf610d7a6264ea1local_auth_darwin: d2e8c53ef0c4f43c646462e3415432c4dab3ae19move_to_background: 7e3467dd2a1d1013e98c9c1cb93fd53cd7ef9d84diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dartindex 4c272b03db..193a035991 100644--- a/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup/local_backup_experience.dart@@ -7,6 +7,7 @@ import 'package:ente_auth/ui/components/buttons/button_widget.dart';import 'package:ente_auth/ui/components/dialog_widget.dart';import 'package:ente_auth/ui/components/models/button_result.dart';import 'package:ente_auth/ui/components/models/button_type.dart';+import 'package:ente_lock_screen/local_authentication_service.dart';import 'package:file_picker/file_picker.dart';import 'package:flutter/material.dart';import 'package:flutter_secure_storage/flutter_secure_storage.dart';@@ -51,11 +52,8 @@ class LocalBackupExperienceController {Future<void> runManualBackup({bool showSnackBar = true}) =>_state._runManualBackup(showSnackBar: showSnackBar);- Future<bool> updatePassword() => _state._promptPassword(- forcePrompt: true,- disableOnCancel: false,- isUpdateFlow: true,- );+ Future<bool> updatePassword(BuildContext context) =>+ _state._updatePassword(context);Future<bool> hasPasswordConfigured() => _state._hasStoredPassword();@@ -193,6 +191,25 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {}}+ Future<bool> _updatePassword(BuildContext context) async {+ // Request app lock authentication first+ final hasAuthenticated =+ await LocalAuthenticationService.instance.requestLocalAuthentication(+ context,+ 'Authenticate to update backup password',+ );++ if (!hasAuthenticated) {+ return false;+ }++ return _promptPassword(+ forcePrompt: true,+ disableOnCancel: false,+ isUpdateFlow: true,+ );+ }+Future<bool> _promptPassword({required bool forcePrompt,bool disableOnCancel = false,@@ -446,14 +463,21 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {for (final marker in markers) {final index = simplified.indexOf(marker);if (index != -1) {- return simplified.substring(index + marker.length);+ final afterMarker = simplified.substring(index + marker.length);+ if (afterMarker.isNotEmpty) {+ return afterMarker;+ }+ final fallbackSegments =+ marker.split('/').where((segment) => segment.isNotEmpty).toList();+ if (fallbackSegments.isNotEmpty) {+ return fallbackSegments.last;+ }+ return simplified;}}- final segments = simplified- .split('/')- .where((segment) => segment.isNotEmpty)- .toList();+ final segments =+ simplified.split('/').where((segment) => segment.isNotEmpty).toList();if (segments.length >= 2) {return segments.sublist(segments.length - 2).join('/');}diff --git a/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart b/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dartindex a964d372aa..63260ca2ef 100644--- a/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart+++ b/mobile/apps/auth/lib/ui/settings/data/local_backup_settings_page.dart@@ -85,7 +85,7 @@ class LocalBackupAppLockVariantPage extends StatelessWidget {trailingIcon: Icons.chevron_right_outlined,trailingIconIsMuted: true,onTap: () async {- await controller.updatePassword();+ await controller.updatePassword(context);},);},