mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
Add user registration bdd tests
This commit is contained in:
@@ -9,13 +9,13 @@ public class AuthService(
|
||||
IPasswordService passwordService
|
||||
) : IAuthService
|
||||
{
|
||||
public async Task<UserAccount?> RegisterAsync(UserAccount userAccount, string password)
|
||||
public async Task<UserAccount> RegisterAsync(UserAccount userAccount, string password)
|
||||
{
|
||||
// Check if user already exists
|
||||
var user = await authRepo.GetUserByUsernameAsync(userAccount.Username);
|
||||
if (user is not null)
|
||||
{
|
||||
return null;
|
||||
return null!;
|
||||
}
|
||||
|
||||
// password hashing
|
||||
@@ -45,9 +45,4 @@ public class AuthService(
|
||||
if (activeCred is null) return null;
|
||||
return !passwordService.Verify(password, activeCred.Hash) ? null : user;
|
||||
}
|
||||
|
||||
public async Task InvalidateAsync(Guid userAccountId)
|
||||
{
|
||||
await authRepo.InvalidateCredentialsByUserAccountIdAsync(userAccountId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user