Add UserCreated hook.
This commit is contained in:
parent
8eee1fd164
commit
018d889ad3
|
|
@ -8,4 +8,5 @@ public interface IAuthenticationHook
|
|||
Task<User> Authenticate(string id, string password);
|
||||
void AddClaims(List<Claim> claims);
|
||||
void BeforeSending(Token token);
|
||||
Task UserCreated(User user);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using BotSharp.Abstraction.Repositories;
|
||||
using BotSharp.Abstraction.Users.Models;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.IdentityModel.Tokens;
|
||||
|
|
@ -57,6 +56,12 @@ public class UserService : IUserService
|
|||
_logger.LogWarning($"Created new user account: {record.Id} {record.UserName}");
|
||||
Utilities.ClearCache();
|
||||
|
||||
var hooks = _services.GetServices<IAuthenticationHook>();
|
||||
foreach (var hook in hooks)
|
||||
{
|
||||
await hook.UserCreated(record);
|
||||
}
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue