Compare commits
No commits in common. "65ba3a64350b1cbca66c7d7ee6b3b1ad6ab68dcb" and "cb75412d199dc77284323fbff6cd89cae0d81dca" have entirely different histories.
65ba3a6435
...
cb75412d19
2 changed files with 3 additions and 10 deletions
|
@ -35,7 +35,7 @@ public class AuthController(
|
|||
);
|
||||
|
||||
if (user is null)
|
||||
return this.BadRequest();
|
||||
return Forbid();
|
||||
|
||||
var session = await authService.CreateStrongSession(user.Id);
|
||||
|
||||
|
|
|
@ -15,17 +15,10 @@ internal class AuthService(AuthContext context, SessionStorage storage) : IAuthS
|
|||
CancellationToken cancellationToken = default
|
||||
)
|
||||
{
|
||||
var user = await context
|
||||
return 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