Пример #1
0
        public IActionResult ResetPasswordOauth(ResetPasswordInput resetPasswordInput)
        {
            if (!_captcha.VerifyCaptcha(resetPasswordInput.Captcha, HttpContext.Connection.RemoteIpAddress,
                                        "resetpassword"))
            {
                _logger.LogInformation("Invalid Captcha.");
                return(BadRequest());
            }

            var user = new User
            {
                Username = resetPasswordInput.Username,
                Password = resetPasswordInput.Password
            };

            if (_authHandler.ResetPassword(ref user, resetPasswordInput.Token))
            {
                _activityLogger.LogResetPassword(Request.HttpContext.Connection.RemoteIpAddress, user);
                return(Ok());
            }

            _logger.LogInformation("Auth handler rejected account.");
            return(BadRequest());
        }