Example #1
0
        public bool ResetPassword(ResetPasswordUpdateRequest model)
        {
            bool result = false;

            try
            {
                string UserId = _emailConfirmationService.SelectById(model.TokenGuid);

                if (!String.IsNullOrEmpty(UserId))
                {
                    ChangePassWord(UserId, model.NewPassword);
                    result = true;
                }
                return(result);
            }
            catch (Exception ex)
            {
                _baseService.LogError(System.Reflection.MethodBase.GetCurrentMethod().Name, ex, "User Service Reset Password");
                throw;
            }
        }
        public HttpResponseMessage UpdatePassword(ResetPasswordUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotAcceptable, string.Join(",", ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage))));
            }
            HttpResponseMessage response = new HttpResponseMessage(HttpStatusCode.RedirectMethod);

            try
            {
                _userService.ResetPassword(model);

                //_emailConfirmationService.ResetPasswordById(model);
                string domain = HttpContext.Current.Request.IsLocal ? "http://localhost:1552" : "https://snatched.azurewebsites.net";
                response.Headers.Location = new Uri(domain + "/Member/SplashPage");

                return(response);
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }