feat: change password
This commit is contained in:
@@ -39,4 +39,28 @@ class UserRepository implements IUserRepository {
|
||||
return left(const UserFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Either<UserFailure, Unit>> changePassword({
|
||||
required String newPassword,
|
||||
required String currentPassword,
|
||||
}) async {
|
||||
try {
|
||||
User currentUser = await _authLocalDataProvider.currentUser();
|
||||
final result = await _dataProvider.changePassword(
|
||||
newPassword: newPassword,
|
||||
currentPassword: currentPassword,
|
||||
userId: currentUser.id,
|
||||
);
|
||||
|
||||
if (result.hasError) {
|
||||
return left(result.error!);
|
||||
}
|
||||
|
||||
return right(unit);
|
||||
} catch (e, s) {
|
||||
log('changePasswordError', name: _logName, error: e, stackTrace: s);
|
||||
return left(const UserFailure.unexpectedError());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user