Example #1
0
        public async Task HandleAsync(LoginUserCommandModel command)
        {
            if (command.TokenId.IsEmpty())
            {
                command.TokenId = Guid.NewGuid();
            }

            await _usersCommandService.LoginAsync(command.Email, command.Password);

            var user = await _usersQueryService.GetByEmailAsync(command.Email);

            var jwt = _jwtManager.CreateToken(user.Id, user.Email, user.Role);

            _cache.SetJwt(command.TokenId, jwt);
        }
Example #2
0
 public async Task <IActionResult> Get(string email)
 => Ok(await _usersQueryService.GetByEmailAsync(email));