Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

mobile: request backup before changing password

Ammar Ahmed9027c4451147
diff --git a/apps/mobile/app/components/auth/change-password.js b/apps/mobile/app/components/auth/change-password.js
index 467cd1a7c..c6c5389da 100644
--- a/apps/mobile/app/components/auth/change-password.js
+++ b/apps/mobile/app/components/auth/change-password.js
@@ -32,6 +32,8 @@ import { Button } from "../ui/button";
import Input from "../ui/input";
import { Notice } from "../ui/notice";
import Seperator from "../ui/seperator";
+import { Dialog } from "../dialog";
+import BackupService from "../../services/backup";
export const ChangePassword = () => {
const passwordInputRef = useRef();
@@ -64,6 +66,7 @@ export const ChangePassword = () => {
}
setLoading(true);
try {
+ await BackupService.run(false, "change-password-dialog");
await db.user.clearSessions();
await db.user.changePassword(oldPassword.current, password.current);
ToastEvent.show({
@@ -92,6 +95,7 @@ export const ChangePassword = () => {
padding: 12
}}
>
+ <Dialog context="change-password-dialog" />
<DialogHeader
title="Change password"
paragraph="Enter your old and new passwords"
diff --git a/apps/mobile/app/services/backup.js b/apps/mobile/app/services/backup.js
index 0cf58fdba..13b3ed372 100644
--- a/apps/mobile/app/services/backup.js
+++ b/apps/mobile/app/services/backup.js
@@ -213,10 +213,12 @@ async function run(progress, context) {
RNFetchBlob.fs.unlink(zipSourceFolder).catch(console.log);
updateNextBackupTime();
- let showBackupCompleteSheet = SettingsService.get().showBackupCompleteSheet;
+ let showBackupCompleteSheet =
+ progress && SettingsService.get().showBackupCompleteSheet;
if (context) return path;
await sleep(300);
+
if (showBackupCompleteSheet) {
presentBackupCompleteSheet(backupFilePath);
} else {
@@ -233,7 +235,7 @@ async function run(progress, context) {
return path;
} catch (e) {
await sleep(300);
- eSendEvent(eCloseSheet);
+ progress && eSendEvent(eCloseSheet);
ToastEvent.error(e, "Backup failed!");
return null;
}