Пример #1
0
        public IActionResult Post([FromBody] LoginDto dto)
        {
            //Provera ulaza
            _validator.ValidateAndThrow(dto);

            var token = manager.MakeToken(dto.Email, dto.Password);

            if (token == null)
            {
                return(Unauthorized());
            }
            return(Ok(new { token }));
        }
        public ActionResult Login([FromBody] Models.Requests.LoginRequest request)
        {
            try
            {
                _loginValidator.ValidateAndThrow(request);
            }
            catch (ValidationException e)
            {
                return(BadRequest(e.Errors));
            }
            _loginUseCase.Handle(new LoginRequest(request.Email, Cipher.Encrypt(request.Password)), _loginPresenter);

            return(_loginPresenter.ContentResult);
        }