1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Can change password

This commit is contained in:
2020-05-03 16:55:00 +02:00
parent 44ea647624
commit 11c25ea271
3 changed files with 156 additions and 1 deletions

View File

@ -158,6 +158,24 @@ class AccountHelper {
.execWithThrow())
.getObject()["reset_token"];
/// Check a password reset token
///
/// Throws in case failure
static Future<void> validatePasswordResetToken(String token) async =>
await APIRequest.withoutLogin("account/check_password_reset_token")
.addString("token", token)
.execWithThrow();
/// Change account password using password reset token
///
/// Throws an exception in case of failure
static Future<void> changeAccountPassword(
String token, String password) async =>
await APIRequest.withoutLogin("account/reset_user_passwd")
.addString("token", token)
.addString("password", password)
.execWithThrow();
/// Get current user ID from the server
Future<int> _downloadCurrentUserID() async {
final response = await APIRequest(