LoginV2: Remove redundant screen pop
This commit is contained in:
parent
d4eef1eb2a
commit
1793f4b61f
|
@ -271,8 +271,9 @@ class Configuration {
|
|||
// SRP setup for existing users.
|
||||
Future<Uint8List> decryptSecretsAndGetKeyEncKey(
|
||||
String password,
|
||||
KeyAttributes attributes,
|
||||
) async {
|
||||
KeyAttributes attributes, {
|
||||
Uint8List? keyEncryptionKey,
|
||||
}) async {
|
||||
validatePreVerificationStateCheck(
|
||||
attributes,
|
||||
password,
|
||||
|
@ -280,7 +281,7 @@ class Configuration {
|
|||
);
|
||||
// Derive key-encryption-key from the entered password and existing
|
||||
// mem and ops limits
|
||||
final keyEncryptionKey = await CryptoUtil.deriveKey(
|
||||
keyEncryptionKey ??= await CryptoUtil.deriveKey(
|
||||
utf8.encode(password) as Uint8List,
|
||||
CryptoUtil.base642bin(attributes.kekSalt),
|
||||
attributes.memLimit!,
|
||||
|
|
|
@ -34,6 +34,7 @@ import 'package:photos/ui/account/two_factor_authentication_page.dart';
|
|||
import 'package:photos/ui/account/two_factor_recovery_page.dart';
|
||||
import 'package:photos/ui/account/two_factor_setup_page.dart';
|
||||
import "package:photos/ui/components/buttons/button_widget.dart";
|
||||
import "package:photos/ui/tabs/home_widget.dart";
|
||||
import 'package:photos/utils/crypto_util.dart';
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
import "package:photos/utils/email_util.dart";
|
||||
|
@ -569,14 +570,15 @@ class UserService {
|
|||
isDismissible: true,
|
||||
);
|
||||
await dialog.show();
|
||||
late Uint8List keyEncryptionKey;
|
||||
try {
|
||||
final kek = await CryptoUtil.deriveKey(
|
||||
keyEncryptionKey = await CryptoUtil.deriveKey(
|
||||
utf8.encode(userPassword) as Uint8List,
|
||||
CryptoUtil.base642bin(srpAttributes.kekSalt),
|
||||
srpAttributes.memLimit,
|
||||
srpAttributes.opsLimit,
|
||||
);
|
||||
final loginKey = await CryptoUtil.deriveLoginKey(kek);
|
||||
final loginKey = await CryptoUtil.deriveLoginKey(keyEncryptionKey);
|
||||
final Uint8List identity = Uint8List.fromList(
|
||||
utf8.encode(srpAttributes.srpUserID),
|
||||
);
|
||||
|
@ -614,7 +616,6 @@ class UserService {
|
|||
},
|
||||
);
|
||||
if (response.statusCode == 200) {
|
||||
await dialog.hide();
|
||||
Widget page;
|
||||
final String twoFASessionID = response.data["twoFactorSessionID"];
|
||||
Configuration.instance.setVolatilePassword(userPassword);
|
||||
|
@ -624,11 +625,17 @@ class UserService {
|
|||
} else {
|
||||
await _saveConfiguration(response);
|
||||
if (Configuration.instance.getEncryptedToken() != null) {
|
||||
page = const PasswordReentryPage();
|
||||
await Configuration.instance.decryptSecretsAndGetKeyEncKey(
|
||||
userPassword,
|
||||
Configuration.instance.getKeyAttributes()!,
|
||||
keyEncryptionKey: keyEncryptionKey,
|
||||
);
|
||||
page = const HomeWidget();
|
||||
} else {
|
||||
throw Exception("unexpected response during email verification");
|
||||
}
|
||||
}
|
||||
await dialog.hide();
|
||||
Navigator.of(context).pushAndRemoveUntil(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
|
|
Loading…
Reference in a new issue