Merge pull request #2409 from ggurdin/enable-sso-account-deletion
fix: enable users without passwords to delete their accounts
This commit is contained in:
commit
6162e005c7
1 changed files with 12 additions and 21 deletions
|
|
@ -74,30 +74,21 @@ class SettingsSecurityController extends State<SettingsSecurity> {
|
||||||
if (mxid == null || mxid.isEmpty || mxid != supposedMxid) {
|
if (mxid == null || mxid.isEmpty || mxid != supposedMxid) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final input = await showTextInputDialog(
|
final resp = await showFutureLoadingDialog(
|
||||||
useRootNavigator: false,
|
|
||||||
context: context,
|
context: context,
|
||||||
title: L10n.of(context).pleaseEnterYourPassword,
|
delay: false,
|
||||||
okLabel: L10n.of(context).ok,
|
future: () =>
|
||||||
cancelLabel: L10n.of(context).cancel,
|
Matrix.of(context).client.uiaRequestBackground<IdServerUnbindResult?>(
|
||||||
isDestructive: true,
|
(auth) => Matrix.of(context).client.deactivateAccount(auth: auth),
|
||||||
obscureText: true,
|
|
||||||
hintText: '******',
|
|
||||||
minLines: 1,
|
|
||||||
maxLines: 1,
|
|
||||||
);
|
|
||||||
if (input == null) return;
|
|
||||||
await showFutureLoadingDialog(
|
|
||||||
context: context,
|
|
||||||
future: () => Matrix.of(context).client.deactivateAccount(
|
|
||||||
auth: AuthenticationPassword(
|
|
||||||
password: input,
|
|
||||||
identifier: AuthenticationUserIdentifier(
|
|
||||||
user: Matrix.of(context).client.userID!,
|
|
||||||
),
|
),
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!resp.isError) {
|
||||||
|
await showFutureLoadingDialog(
|
||||||
|
context: context,
|
||||||
|
future: () => Matrix.of(context).client.logout(),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> dehydrateAction() => Matrix.of(context).dehydrateAction(context);
|
Future<void> dehydrateAction() => Matrix.of(context).dehydrateAction(context);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue