public IActionResult ChangePassword(string oldPassword, string password) { if (!sessMan.IsLoggedIn()) { return(RedirectToAction("Main", "Page")); } User user = UModel.GetUserById(sessMan.GetUserId()); user = UModel.ValidateUser(user, oldPassword); if (user != null) { UModel.ChangePassword(user, password); return(RedirectToAction("Main", "Page")); } else { ValidViewModel pageVM = new ValidViewModel { Pages = PModel.GetMenu(), CurrentPage = new Page { InternalName = "ChangePassword", DisplayName = "Wachtwoord Wijzigen" }, Dynamic = false, Error = 1 }; return(View(pageVM)); } }
/** * GET /User/Login */ public IActionResult Login() { ValidViewModel pageVM = new ValidViewModel { Pages = PModel.GetMenu(), CurrentPage = new Page { InternalName = "Login", DisplayName = "Inloggen" }, Dynamic = false, Error = 0 }; return(View(pageVM)); }
/** * GET /User/ChangePassword */ public IActionResult ChangePassword() { if (!sessMan.IsLoggedIn()) { return(RedirectToAction("Main", "Page")); } ValidViewModel pageVM = new ValidViewModel { Pages = PModel.GetMenu(), CurrentPage = new Page { InternalName = "ChangePassword", DisplayName = "Wachtwoord Wijzigen" }, Dynamic = false, Error = 0 }; return(View(pageVM)); }
public IActionResult Login(string email, string password) { User user = UModel.ValidateLogin(email, password); if (user != null) { sessMan.Login(user.Id, user.FirstName, user.Admin); return(RedirectToAction("Main", "Page")); } else { ValidViewModel pageVM = new ValidViewModel { Pages = PModel.GetMenu(), CurrentPage = new Page { InternalName = "Login", DisplayName = "Inloggen" }, Dynamic = false, Error = 1 }; return(View(pageVM)); } }