Skip to content

armgit / ente

Public Imported from GitHub
0

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

[photos]Always reset volatile password on login

Neeraj Gupta8101ddf4bc84
diff --git a/mobile/lib/core/configuration.dart b/mobile/lib/core/configuration.dart
index 91a23f2ff6..8579c6f996 100644
--- a/mobile/lib/core/configuration.dart
+++ b/mobile/lib/core/configuration.dart
@@ -580,10 +580,14 @@ class Configuration {
return _preferences.setBool(keyShouldShowLockScreen, value);
}
- void setVolatilePassword(String? volatilePassword) {
+ void setVolatilePassword(String volatilePassword) {
_volatilePassword = volatilePassword;
}
+ void resetVolatilePassword() {
+ _volatilePassword = null;
+ }
+
String? getVolatilePassword() {
return _volatilePassword;
}
diff --git a/mobile/lib/ui/account/login_page.dart b/mobile/lib/ui/account/login_page.dart
index 9ffc6dca69..2d620ecb2a 100644
--- a/mobile/lib/ui/account/login_page.dart
+++ b/mobile/lib/ui/account/login_page.dart
@@ -69,6 +69,7 @@ class _LoginPageState extends State<LoginPage> {
buttonText: S.of(context).logInLabel,
onPressedFunction: () async {
await UserService.instance.setEmail(_email!);
+ Configuration.instance.resetVolatilePassword();
SrpAttributes? attr;
bool isEmailVerificationEnabled = true;
try {
diff --git a/mobile/lib/ui/account/password_entry_page.dart b/mobile/lib/ui/account/password_entry_page.dart
index 2396b93e82..a5099e333e 100644
--- a/mobile/lib/ui/account/password_entry_page.dart
+++ b/mobile/lib/ui/account/password_entry_page.dart
@@ -437,7 +437,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
try {
final KeyGenResult result =
await Configuration.instance.generateKey(password);
- Configuration.instance.setVolatilePassword(null);
+ Configuration.instance.resetVolatilePassword();
await dialog.hide();
onDone() async {
final dialog = createProgressDialog(context, S.of(context).pleaseWait);
@@ -445,7 +445,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
try {
await UserService.instance.setAttributes(result);
await dialog.hide();
- Configuration.instance.setVolatilePassword(null);
+ Configuration.instance.resetVolatilePassword();
Bus.instance.fire(AccountConfiguredEvent());
// ignore: unawaited_futures
Navigator.of(context).pushAndRemoveUntil(
diff --git a/mobile/lib/ui/account/password_reentry_page.dart b/mobile/lib/ui/account/password_reentry_page.dart
index 20c1280caf..1b240134f9 100644
--- a/mobile/lib/ui/account/password_reentry_page.dart
+++ b/mobile/lib/ui/account/password_reentry_page.dart
@@ -150,7 +150,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
return;
}
await dialog.hide();
- Configuration.instance.setVolatilePassword(null);
+ Configuration.instance.resetVolatilePassword();
Bus.instance.fire(SubscriptionPurchasedEvent());
unawaited(
Navigator.of(context).pushAndRemoveUntil(