feat: change password

This commit is contained in:
efrilm
2025-08-19 15:35:18 +07:00
parent 7919825955
commit 1b1e8c5bb4
14 changed files with 1247 additions and 119 deletions
@@ -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());
}
}
}