Пример #1
0
        public ResponseModel<String> ResetPasswordService(ResetPasswordRequest req)
        {
            var response = new ResponseModel<string>();
            //EncryptionClass.GetDecryptionValue(req.Username, ConfigurationManager.AppSettings["AuthKey"]);
            if (_db.ForgetPasswords.Any(x => x.guid == req.Guid))
            {
                var removeForgetPasswordData = _db.ForgetPasswords.SingleOrDefault(x => x.guid == req.Guid);
                _db.ForgetPasswords.Remove(removeForgetPasswordData);

                var userData = _db.Users.SingleOrDefault(x => x.Username == removeForgetPasswordData.Username);
                if (userData != null)
                {
                    var password = EncryptionClass.Md5Hash(req.Password);
                    userData.Password = password;
                    userData.Locked = "false";
                }
                try
                {
                    _db.SaveChanges();
                }
                catch (DbEntityValidationException e)
                {
                    DbContextException.LogDbContextException(e);
                    response.Status = 500;
                    response.Message = "Internal Server Error.";
                    Logger.Info("Save new Reseted Password : "******"Success";
                return response;
            }
            response.Status = 402;
            response.Message = "link expired";
            return response;
        }
Пример #2
0
 public JsonResult ResetPassword(ResetPasswordRequest req)
 {
     return Json(new AuthService().ResetPasswordService(req));
 }