diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-20 18:35:47 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-20 18:35:47 -0600 |
commit | 4d34da521dd05b16b25d1aa2de2567de9d920512 (patch) | |
tree | 0d8062cce645171c8c859f344a2669ae616dd661 /Logics/CreateUserAccountSessionLogic.cs | |
parent | 45c2616816d62e347cd443a83b184ce5096f3061 (diff) |
Añadido signup de usuarios normales
Diffstat (limited to 'Logics/CreateUserAccountSessionLogic.cs')
-rw-r--r-- | Logics/CreateUserAccountSessionLogic.cs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Logics/CreateUserAccountSessionLogic.cs b/Logics/CreateUserAccountSessionLogic.cs new file mode 100644 index 0000000..2e51791 --- /dev/null +++ b/Logics/CreateUserAccountSessionLogic.cs @@ -0,0 +1,31 @@ +using Microsoft.AspNetCore.Identity; +using BackendPIA.Services; +using BackendPIA.Models; +using BackendPIA.Forms; + +namespace BackendPIA.Logics { + public class CreateUserAccountSessionLogic : BaseUserAccountLogic { + private readonly UserAccountLoginForm _form; + + public CreateUserAccountSessionLogic(ITokenGenerator token_generator, UserManager<UserAccount> manager, UserAccountLoginForm form) : base(token_generator, manager) { + _form = form; + } + + public async Task<bool> Call() { + var user = await _manager.FindByEmailAsync(_form.Email); + + if(user == null ) + return false; + + var result = await _manager.CheckPasswordAsync(user, _form.Password); + + if(result) { + await SetAuthenticationToken(user); + + return true; + } + + return false; + } + } +}
\ No newline at end of file |