19 lines
No EOL
582 B
C#
19 lines
No EOL
582 B
C#
using Femto.Modules.Authentication.Data;
|
|
using Femto.Modules.Authentication.Models;
|
|
using MediatR;
|
|
|
|
namespace Femto.Modules.Authentication.Application.Commands;
|
|
|
|
internal class LoginCommandHandler(AuthenticationContext context) : IRequestHandler<LoginCommand, Guid>
|
|
{
|
|
public async Task<Guid> Handle(LoginCommand request, CancellationToken cancellationToken)
|
|
{
|
|
var user = new UserIdentity(request.Username);
|
|
|
|
user.SetPassword(request.Password);
|
|
|
|
await context.AddAsync(user, cancellationToken);
|
|
|
|
return user.Id;
|
|
}
|
|
} |