✨ Reset password
This commit is contained in:
parent
688f035f85
commit
ebde4eeed5
@ -281,5 +281,7 @@
|
|||||||
"settingsEnterToSend": "Enter to Send",
|
"settingsEnterToSend": "Enter to Send",
|
||||||
"postTitle": "Title",
|
"postTitle": "Title",
|
||||||
"postDescription": "Description",
|
"postDescription": "Description",
|
||||||
"call": "Call"
|
"call": "Call",
|
||||||
|
"done": "Done",
|
||||||
|
"loginResetPasswordSent": "Password reset link sent, please check your email inbox."
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,8 @@ import 'package:material_symbols_icons/symbols.dart';
|
|||||||
import 'package:styled_widget/styled_widget.dart';
|
import 'package:styled_widget/styled_widget.dart';
|
||||||
import 'package:url_launcher/url_launcher_string.dart';
|
import 'package:url_launcher/url_launcher_string.dart';
|
||||||
|
|
||||||
|
import 'captcha.dart';
|
||||||
|
|
||||||
final Map<int, (String, String, IconData)> kFactorTypes = {
|
final Map<int, (String, String, IconData)> kFactorTypes = {
|
||||||
0: ('authFactorPassword', 'authFactorPasswordDescription', Symbols.password),
|
0: ('authFactorPassword', 'authFactorPasswordDescription', Symbols.password),
|
||||||
1: ('authFactorEmail', 'authFactorEmailDescription', Symbols.email),
|
1: ('authFactorEmail', 'authFactorEmailDescription', Symbols.email),
|
||||||
@ -354,15 +356,18 @@ class _LoginLookupScreen extends HookConsumerWidget {
|
|||||||
showErrorAlert('loginResetPasswordHint'.tr());
|
showErrorAlert('loginResetPasswordHint'.tr());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
final captchaTk = await Navigator.of(
|
||||||
|
context,
|
||||||
|
).push(MaterialPageRoute(builder: (context) => CaptchaScreen()));
|
||||||
|
if (captchaTk == null) return;
|
||||||
isBusy.value = true;
|
isBusy.value = true;
|
||||||
try {
|
try {
|
||||||
final client = ref.watch(apiClientProvider);
|
final client = ref.watch(apiClientProvider);
|
||||||
final lookupResp = await client.get('/users/lookup?probe=$uname');
|
|
||||||
await client.post(
|
await client.post(
|
||||||
'/users/me/password-reset',
|
'/accounts/recovery/password',
|
||||||
data: {'user_id': lookupResp.data['id']},
|
data: {'account': uname, 'captcha_token': captchaTk},
|
||||||
);
|
);
|
||||||
showInfoAlert('done'.tr(), 'signinResetPasswordSent'.tr());
|
showInfoAlert('loginResetPasswordSent'.tr(), 'done'.tr());
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
showErrorAlert(err);
|
showErrorAlert(err);
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user