feat: New change password page with server capabilities check

This commit is contained in:
krille-chan 2023-12-23 09:48:35 +01:00
commit 5847fe0546
No known key found for this signature in database
7 changed files with 296 additions and 94 deletions

View file

@ -23,42 +23,6 @@ class SettingsSecurity extends StatefulWidget {
}
class SettingsSecurityController extends State<SettingsSecurity> {
void changePasswordAccountAction() async {
final input = await showTextInputDialog(
useRootNavigator: false,
context: context,
title: L10n.of(context)!.changePassword,
okLabel: L10n.of(context)!.ok,
cancelLabel: L10n.of(context)!.cancel,
textFields: [
DialogTextField(
hintText: L10n.of(context)!.chooseAStrongPassword,
obscureText: true,
minLines: 1,
maxLines: 1,
),
DialogTextField(
hintText: L10n.of(context)!.repeatPassword,
obscureText: true,
minLines: 1,
maxLines: 1,
),
],
);
if (input == null) return;
final success = await showFutureLoadingDialog(
context: context,
future: () => Matrix.of(context)
.client
.changePassword(input.last, oldPassword: input.first),
);
if (success.error == null) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context)!.passwordHasBeenChanged)),
);
}
}
void setAppLockAction() async {
if (AppLock.of(context).isActive) {
AppLock.of(context).showLockScreen();