1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-20 00:35:17 +00:00

Can change password

This commit is contained in:
2020-04-30 18:19:01 +02:00
parent 29cc8558c3
commit 289bf30a40
4 changed files with 165 additions and 1 deletions

View File

@ -1,5 +1,8 @@
import 'package:comunic/helpers/settings_helper.dart';
import 'package:comunic/ui/dialogs/input_new_password_dialog.dart';
import 'package:comunic/ui/dialogs/input_user_password_dialog.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
import 'package:settings_ui/settings_ui.dart';
@ -46,6 +49,22 @@ class __AccountSecuritySettingsScreenBodyState
/// Change current user password
void _changePassword() async {
final currPassword = await showUserPasswordDialog(context);
try {
final currPassword = await showUserPasswordDialog(context);
if (currPassword == null) return;
final newPassword = await showInputNewPassword(context);
if (newPassword == null) return;
await SettingsHelper.changePassword(currPassword, newPassword);
showSimpleSnack(
context, tr("Your password has been successfully changed!"));
} catch (e, stack) {
print("Could not update current user password! $e\n$stack");
showSimpleSnack(context, tr("Could not update password!"));
}
}
}