当前位置: 首页>>代码示例>>C#>>正文


C# ResetPasswordViewModel类代码示例

本文整理汇总了C#中ResetPasswordViewModel的典型用法代码示例。如果您正苦于以下问题:C# ResetPasswordViewModel类的具体用法?C# ResetPasswordViewModel怎么用?C# ResetPasswordViewModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ResetPasswordViewModel类属于命名空间,在下文中一共展示了ResetPasswordViewModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResetPassword

 public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
 {
     if (!ModelState.IsValid)
     {
         return View(model);
     }
     var user = await UserManager.FindByNameAsync(model.Email);
     if (user == null)
     {
         // Don't reveal that the user does not exist
         return RedirectToAction("ResetPasswordConfirmation", "User");
     }
     if (model.Password != model.ConfirmPassword)
     {
         ModelState.AddModelError("", "Password and Confirm Password Mismatch");
         return View();
     }
     var result = await UserManager.ResetPasswordAsync(user.Id,  model.Code.Replace(" ", "+"), model.Password); 
     if (result.Succeeded)
     {
         return RedirectToAction("ResetPasswordConfirmation", "User");
     }
     AddErrors(result);
     return View();
 }
开发者ID:jdsv650,项目名称:BwareApp_API,代码行数:25,代码来源:UserController.cs

示例2: ResetPassword

        public ActionResult ResetPassword(ResetPasswordViewModel model)
        {
            if (!ModelState.IsValid)
                return Json(new ServiceOperationResult(false) {Message = Main.InvalidForm});

            return Json(PiServices.UserService.ChangePassword(model));
        }
开发者ID:jacbar,项目名称:Runner,代码行数:7,代码来源:AccountController.cs

示例3: TryResetPassword

        private ActionResult TryResetPassword(ResetPasswordViewModel model)
        {
            try
            {
                var tokenValidation = this.Service.ValidateResetToken(model.ResetToken);
                if (tokenValidation.Type == ResetToken.ResetType.Both)
                {
                    if (!this.Service.IsPasswordStrengthPassed(model.Password))
                        throw new WeakPasswordException();

                    SavePasswordToSession(model.Password);
                    return RedirectToAction("ResetSecurePhrase", new { resetToken = model.ResetToken });
                }

                this.Service.FinishResetPassword(model.ResetToken, model.Password);
                return RedirectToAction("ResetPasswordConfirmation");
            }
            catch (InvalidResetTokenException)
            {
                AddModelStateError(GlobalStrings.ResetTokenIsInvalid);
            }
            catch (WeakPasswordException)
            {
                AddModelStateError(GlobalStrings.WeakPassword);
            }
            catch (Exception)
            {
                AddModelStateError(GlobalStrings.SomethingWentWrong);
            }

            return View(model);
        }
开发者ID:Cognite-Soft,项目名称:ARB_2016_V2,代码行数:32,代码来源:AccountControllerResetPassword.cs

示例4: ResetPassword

        public ActionResult ResetPassword(ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
                return TryResetPassword(model);

            // If we got this far, something failed, redisplay form
            return View(model);
        }
开发者ID:Cognite-Soft,项目名称:ARB_2016_V2,代码行数:8,代码来源:AccountControllerResetPassword.cs

示例5: ResetPasswordView

        private ActionResult ResetPasswordView(string resetToken)
        {
            var model = new ResetPasswordViewModel()
            {
                ResetToken = resetToken,
            };

            return View(model);
        }
开发者ID:Cognite-Soft,项目名称:ARB_2016_V2,代码行数:9,代码来源:AccountControllerResetPassword.cs

示例6: ChangePassword

        public ServiceOperationResult ChangePassword(ResetPasswordViewModel model)
        {
            User user = UserRepository.GetUser(UserName);
            if(user.Password != HashHelpers.GetSHA256Hash(model.OldPassword, user.Salt.ToString()))
            {
                return new ServiceOperationResult(false) {Message = Main.OldPasswordInvalid};
            }

            return Mapper.Map<DataResult, ServiceOperationResult>(UserRepository.ChangePassword(user, model.NewPassword));
        }
开发者ID:jacbar,项目名称:Runner,代码行数:10,代码来源:UserService.cs

示例7: ResetPassword

        public ActionResult ResetPassword(string userName)
        {
            
            var model = new ResetPasswordViewModel()
                            {
                                Username = userName,
                                NewPassword = "123456" // generate
                            };

            // reset the password
            return View(model);
        }
开发者ID:shaimuli,项目名称:Simple.SAMS,代码行数:12,代码来源:AccountController.cs

示例8: ResetPassword

        public ActionResult ResetPassword(ResetPasswordViewModel model)
        {
            if(ModelState.IsValid)
            {
                membershipService.ResetPassword(model.Username);
                membershipService.Commit();

                SuccessMessage(FormMessages.AccountResetPassword);
                return RedirectToAction("Index", "Home");
            }

            return View(model);
        }
开发者ID:philjhale,项目名称:TeessideBasketballLeague,代码行数:13,代码来源:AccountController.cs

示例9: ResetPassword

        public ActionResult ResetPassword(string code)
        {
            if (code == null)
            {
                return View("Error");
            }

            ResetPasswordViewModel md = new ResetPasswordViewModel()
            {
                Code = code
            };

            return View(md);
        }
开发者ID:jcingroup,项目名称:C381421_ChengShen,代码行数:14,代码来源:MNGLoginController.cs

示例10: Index

        public ActionResult Index(ResetPasswordViewModel rp)
        {
            //get the email from the URL
            string email = Request.QueryString["user_email"];

            //collect the data from the form
            if (ModelState.IsValid)
            {

                if (!SecurityHelper.StripHTML(rp.Password).Equals(SecurityHelper.StripHTML(rp.ConfPassword))) //the passwords have to match
                {
                    ViewBag.Message = "The two passwords have to match.";
                    return View("ResetPassword");
                }
                else //made it through both checks
                {

                    var collectUser = (
                        from usr in db.Users
                        where usr.email.Equals(SecurityHelper.StripHTML(email))
                        select usr
                        ).First();

                    collectUser.password = AuthenticationHelper.ENCRYPT_ME(SecurityHelper.StripHTML(rp.Password));

                    try
                    {
                        db.SaveChanges();
                        return RedirectToAction("Index", "Login");
                    }
                    catch (Exception ex)
                    {
                        ViewBag.Message = "Something weird happened. Try again.";
                        return View("ResetPassword");
                    }

                }

            }
            else
            {
                ViewBag.Message = "You have to fill in both fields.";
                return View("ResetPassword");
            }
        }
开发者ID:jotsb,项目名称:CST-Life-No-More-C--MVC4,代码行数:45,代码来源:ResetPasswordController.cs

示例11: ResetPassword

        public ActionResult ResetPassword(int userId, string token)
        {
            var model = new ResetPasswordViewModel()
            {
                Token = token,
                UserId = userId
            };

            return token == null ? View("Error") : View(model);
        }
开发者ID:inatoff,项目名称:ACTS_Site,代码行数:10,代码来源:AccountController.cs

示例12: ResetPassword

        public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);
                if (user == null)
                {
                    ModelState.AddModelError("", "找不到用户。");
                    return View();
                }
                IdentityResult result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
                if (result.Succeeded)
                {
                    return RedirectToAction("ResetPasswordConfirmation", "Account");
                }
                else
                {
                    AddErrors(result);
                    return View();
                }
            }

            // 如果我们进行到这一步时某个地方出错,则重新显示表单
            return View(model);
        }
开发者ID:K-Library-NET,项目名称:PopcornStudios,代码行数:25,代码来源:AccountController.cs

示例13: ResetPassword

 public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
 {
     if (!this.ModelState.IsValid)
     {
         return this.View(model);
     }
     var user = await this.UserManager.FindByNameAsync(model.Email);
     if (user == null)
     {
         // Don't reveal that the user does not exist
         return this.RedirectToAction("ResetPasswordConfirmation", "Account");
     }
     var result = await this.UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
     if (result.Succeeded)
     {
         return this.RedirectToAction("ResetPasswordConfirmation", "Account");
     }
     this.AddErrors(result);
     return this.View();
 }
开发者ID:ASP-MVC,项目名称:Twitter-Like,代码行数:20,代码来源:AccountController.cs

示例14: ResetPassword

        public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);
                if (user == null)
                {
                    ModelState.AddModelError("", "Es wurde kein Benutzer gefunden.");
                    return View();
                }
                IdentityResult result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
                if (result.Succeeded)
                {
                    return RedirectToAction("ResetPasswordConfirmation", "Account");
                }
                else
                {
                    AddErrors(result);
                    return View();
                }
            }

            // Wurde dieser Punkt erreicht, ist ein Fehler aufgetreten. Formular erneut anzeigen.
            return View(model);
        }
开发者ID:GundlackFelixDEV,项目名称:ASP.NET_TUTS,代码行数:25,代码来源:AccountController.cs

示例15: ResetPassword

        public async Task<ActionResult> ResetPassword(ResetPasswordViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await UserManager.FindByNameAsync(model.Email);
                if (user == null)
                {
                    ModelState.AddModelError("", "No se encontró ningún usuario.");
                    return View();
                }
                IdentityResult result = await UserManager.ResetPasswordAsync(user.Id, model.Code, model.Password);
                if (result.Succeeded)
                {
                    return RedirectToAction("ResetPasswordConfirmation", "Account");
                }
                else
                {
                    AddErrors(result);
                    return View();
                }
            }

            // Si llegamos a este punto, es que se ha producido un error y volvemos a mostrar el formulario
            return View(model);
        }
开发者ID:esmar,项目名称:appWeb,代码行数:25,代码来源:AccountController.cs


注:本文中的ResetPasswordViewModel类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。