oops
This commit is contained in:
parent
cb75412d19
commit
a57515c33e
1 changed files with 9 additions and 2 deletions
|
@ -15,10 +15,17 @@ internal class AuthService(AuthContext context, SessionStorage storage) : IAuthS
|
|||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
return await context
|
||||
var user = await context
|
||||
.Users.Where(u => u.Username == username)
|
||||
.Select(u => new UserInfo(u.Id, u.Username, u.Roles.Select(r => r.Role).ToList()))
|
||||
.SingleOrDefaultAsync(cancellationToken);
|
||||
|
||||
if (user is null)
|
||||
return null;
|
||||
|
||||
if (!user.HasPassword(password))
|
||||
return null;
|
||||
|
||||
return new UserInfo(user.Id, user.Username, user.Roles.Select(r => r.Role).ToList());
|
||||
}
|
||||
|
||||
public Task<UserInfo?> GetUserWithId(Guid? userId, CancellationToken cancellationToken)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue