Add one-time password recovery flow
This commit is contained in:
@@ -229,6 +229,27 @@ class ApiRepository {
|
||||
required String password,
|
||||
}) => _authenticateAccount('login', email, password);
|
||||
|
||||
Future<void> requestPasswordReset(String email) async {
|
||||
final response = await http.post(
|
||||
Uri.parse('$_baseUrl/v1/auth/password-reset/request'),
|
||||
headers: const {'Content-Type': 'application/json'},
|
||||
body: jsonEncode({'email': email}),
|
||||
);
|
||||
_checkStatus(response);
|
||||
}
|
||||
|
||||
Future<void> completePasswordReset({
|
||||
required String token,
|
||||
required String newPassword,
|
||||
}) async {
|
||||
final response = await http.post(
|
||||
Uri.parse('$_baseUrl/v1/auth/password-reset/complete'),
|
||||
headers: const {'Content-Type': 'application/json'},
|
||||
body: jsonEncode({'token': token, 'new_password': newPassword}),
|
||||
);
|
||||
_checkStatus(response);
|
||||
}
|
||||
|
||||
Future<Map<String, dynamic>> _authenticateAccount(
|
||||
String action,
|
||||
String email,
|
||||
|
||||
Reference in New Issue
Block a user