Skip to content

armgit / ente

Public Imported from GitHub
0

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

Log improvements (#444)

Neeraj Gupta310d32def274
diff --git a/lib/core/configuration.dart b/lib/core/configuration.dart
index 0717e4b46a..3e6540af65 100644
--- a/lib/core/configuration.dart
+++ b/lib/core/configuration.dart
@@ -469,10 +469,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/lib/ui/account/email_entry_page.dart b/lib/ui/account/email_entry_page.dart
index ce72f9262f..a20f6e245d 100644
--- a/lib/ui/account/email_entry_page.dart
+++ b/lib/ui/account/email_entry_page.dart
@@ -105,8 +105,8 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
isFormValid: _isFormValid(),
buttonText: context.l10n.createAccount,
onPressedFunction: () {
- _config.setVolatilePassword(_passwordController1.text);
UserService.instance.setEmail(_email!);
+ _config.setVolatilePassword(_passwordController1.text);
UserService.instance.setRefSource(_referralSource);
UserService.instance
.sendOtt(context, _email!, isCreateAccountScreen: true);
diff --git a/lib/ui/account/password_entry_page.dart b/lib/ui/account/password_entry_page.dart
index 9b5879917f..59fd72a353 100644
--- a/lib/ui/account/password_entry_page.dart
+++ b/lib/ui/account/password_entry_page.dart
@@ -60,7 +60,10 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
if (_volatilePassword != null) {
Future.delayed(
Duration.zero,
- () => _showRecoveryCodeDialog(_volatilePassword!),
+ () => _showRecoveryCodeDialog(
+ _volatilePassword!,
+ usingVolatilePassword: true,
+ ),
);
}
_password1FocusNode.addListener(() {
@@ -421,15 +424,21 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
return logOutFromOther;
}
- Future<void> _showRecoveryCodeDialog(String password) async {
+ Future<void> _showRecoveryCodeDialog(
+ String password, {
+ bool usingVolatilePassword = false,
+ }) async {
final l10n = context.l10n;
final dialog =
createProgressDialog(context, l10n.generatingEncryptionKeysTitle);
await dialog.show();
try {
+ if (usingVolatilePassword) {
+ _logger.info('Using volatile password');
+ }
final KeyGenResult result =
await Configuration.instance.generateKey(password);
- Configuration.instance.setVolatilePassword(null);
+ Configuration.instance.resetVolatilePassword();
await dialog.hide();
onDone() async {
final dialog = createProgressDialog(context, l10n.pleaseWait);
@@ -437,7 +446,7 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
try {
await UserService.instance.setAttributes(result);
await dialog.hide();
- Configuration.instance.setVolatilePassword(null);
+ Configuration.instance.resetVolatilePassword();
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
diff --git a/lib/ui/account/password_reentry_page.dart b/lib/ui/account/password_reentry_page.dart
index aab2553ebc..620884e6f3 100644
--- a/lib/ui/account/password_reentry_page.dart
+++ b/lib/ui/account/password_reentry_page.dart
@@ -40,7 +40,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
_passwordController.text = _volatilePassword!;
Future.delayed(
Duration.zero,
- () => verifyPassword(_volatilePassword!),
+ () => verifyPassword(_volatilePassword!, usingVolatilePassword: true),
);
}
_passwordFocusNode.addListener(() {
@@ -90,11 +90,16 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
);
}
- Future<void> verifyPassword(String password) async {
+ Future<void> verifyPassword(
+ String password, {
+ bool usingVolatilePassword = false,
+ }) async {
FocusScope.of(context).unfocus();
- final dialog =
- createProgressDialog(context, context.l10n.pleaseWait);
+ final dialog = createProgressDialog(context, context.l10n.pleaseWait);
await dialog.show();
+ if (usingVolatilePassword) {
+ _logger.info("Using volatile password");
+ }
try {
final kek = await Configuration.instance.decryptSecretsAndGetKeyEncKey(
password,
@@ -140,8 +145,8 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
}
return;
}
+ Configuration.instance.resetVolatilePassword();
await dialog.hide();
- Configuration.instance.setVolatilePassword(null);
unawaited(
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
@@ -149,7 +154,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
return const HomePage();
},
),
- (route) => false,
+ (route) => false,
),
);
}
@@ -183,7 +188,7 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
children: [
Padding(
padding:
- const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
+ const EdgeInsets.symmetric(vertical: 30, horizontal: 20),
child: Text(
context.l10n.welcomeBack,
style: Theme.of(context).textTheme.headlineMedium,
@@ -218,19 +223,19 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
),
suffixIcon: _passwordInFocus
? IconButton(
- icon: Icon(
- _passwordVisible
- ? Icons.visibility
- : Icons.visibility_off,
- color: Theme.of(context).iconTheme.color,
- size: 20,
- ),
- onPressed: () {
- setState(() {
- _passwordVisible = !_passwordVisible;
- });
- },
- )
+ icon: Icon(
+ _passwordVisible
+ ? Icons.visibility
+ : Icons.visibility_off,
+ color: Theme.of(context).iconTheme.color,
+ size: 20,
+ ),
+ onPressed: () {
+ setState(() {
+ _passwordVisible = !_passwordVisible;
+ });
+ },
+ )
: null,
),
style: const TextStyle(
@@ -276,9 +281,9 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
.textTheme
.titleMedium!
.copyWith(
- fontSize: 14,
- decoration: TextDecoration.underline,
- ),
+ fontSize: 14,
+ decoration: TextDecoration.underline,
+ ),
),
),
),
@@ -302,9 +307,9 @@ class _PasswordReentryPageState extends State<PasswordReentryPage> {
.textTheme
.titleMedium!
.copyWith(
- fontSize: 14,
- decoration: TextDecoration.underline,
- ),
+ fontSize: 14,
+ decoration: TextDecoration.underline,
+ ),
),
),
),
diff --git a/pubspec.yaml b/pubspec.yaml
index 85769897e6..42063a1224 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: ente_auth
description: ente two-factor authenticator
-version: 2.0.31+231
+version: 2.0.32+232
publish_to: none
environment: