Beispiel #1
0
        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));
            }
        }
Beispiel #2
0
        /**
         * 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));
        }
Beispiel #3
0
        /**
         * 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));
        }
Beispiel #4
0
        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));
            }
        }