deleting password
This commit is contained in:
parent
36d8cc9a4d
commit
2519fc77d2
15 changed files with 237 additions and 47 deletions
|
@ -0,0 +1,22 @@
|
|||
using Femto.Modules.Auth.Data;
|
||||
using Femto.Modules.Auth.Models.Events;
|
||||
using MediatR;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Femto.Modules.Auth.Models.DomainEventHandlers;
|
||||
|
||||
internal class UserPasswordChangedHandler(AuthContext context)
|
||||
: INotificationHandler<UserWasCreatedEvent>
|
||||
{
|
||||
public async Task Handle(UserWasCreatedEvent notification, CancellationToken cancellationToken)
|
||||
{
|
||||
var longTermSessions = await context
|
||||
.LongTermSessions.Where(s => s.UserId == notification.User.Id)
|
||||
.ToListAsync(cancellationToken);
|
||||
|
||||
foreach (var session in longTermSessions)
|
||||
{
|
||||
session.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue