Create minimal app
This commit is contained in:
parent
6b87902ca7
commit
27aaee6293
17 changed files with 346 additions and 52 deletions
|
@ -50,4 +50,20 @@ public class UserService(IUserRepository userRepository, Domain.Interfaces.IPass
|
|||
|
||||
return new IUserService.RegisterNewUserResult(user, null);
|
||||
}
|
||||
|
||||
public async Task<IUserService.LoginResult> Login(string username, string password)
|
||||
{
|
||||
var user = await _userRepository.GetByUsernameAsync(username);
|
||||
if (user == null)
|
||||
{
|
||||
return new IUserService.LoginResult(null, "User not found.");
|
||||
}
|
||||
|
||||
if (!user.VerifyPassword(password, _passwordHasher))
|
||||
{
|
||||
return new IUserService.LoginResult(null, "Wrong password.");
|
||||
}
|
||||
|
||||
return new IUserService.LoginResult(user, null);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue