Exemple #1
0
 public ViewResult ChangePassword()
 {
     var model = new NewPasswordModel();
     if (HttpContext.Session != null)
     {
        model.UserName = HttpContext.Session["currentUserID"].ToString();
     }
     return View("ChangePassword", model);
 }
Exemple #2
0
 public ActionResult ChangePassword(NewPasswordModel model)
 {
     try
     {
         if(model.NewPassword == model.RepeatPassword)
         {
             _userService.UpdatePassword(model.UserName, model.NewPassword);
             return RedirectToAction("Index", "Home");
         }
         TempData["Message"] = "Nytt passord og gjentatt passord er ikke likt.";
         return View("ChangePassword", model);
     }
     catch (Exception)
     {
         TempData["Message"] = "Ukjent feil har oppstått";
         return RedirectToAction("LogIn", "LogIn");
     }
 }