Skip to content

armgit / ente

Public Imported from GitHub
0

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

Require auth before enabling backups

Prateek Sunalaf08debe5eef
diff --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.dart
index 2589039368..722938ccef 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
@@ -110,6 +110,12 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
await _withBusyGuard(
() async {
if (shouldEnable) {
+ final authenticated = await _authenticateForBackupAction(
+ 'Authenticate to enable backups',
+ );
+ if (!authenticated) {
+ return;
+ }
final success = await _startEnableFlow();
if (!success) {
return;
@@ -212,6 +218,13 @@ class _LocalBackupExperienceState extends State<LocalBackupExperience> {
return true;
}
+ Future<bool> _authenticateForBackupAction(String reason) async {
+ return LocalAuthenticationService.instance.requestLocalAuthentication(
+ context,
+ reason,
+ );
+ }
+
Future<void> _withBusyGuard(
Future<void> Function() action, {
bool showOverlay = true,