Exemplo n.º 1
0
        public Administrators AdminLogIn(string login, string password)
        {
            password = _hashProvider.Encrypt(password);

            var admin = _repository.GetAdmins().SingleOrDefault(el => el.login == login && el.password == password);

            return(admin);
        }
Exemplo n.º 2
0
        public ActionResult ChangePassword(string oldPass, string newPass, string checkNewPass)
        {
            if (repository.checkRegisteredPhoneNumber(SessionPersister.Login) == false)
            {
                return(View("EditPhone"));
            }
            if (repository.checkRegisteredEmail(SessionPersister.Login) == false)
            {
                return(View("EditEMail"));
            }

            var           login      = SessionPersister.Login;
            var           studentAcc = repository.GetUser(login);
            IHashProvider encoder    = new HashProvider();

            if (studentAcc.password.ToUpper() != encoder.Encrypt(oldPass))
            {
                ViewBag.ChangePassValidate = "Старий пароль вказано не вірно";
            }
            else
            {
                repository.ChangeUserPass(login, newPass);
            }
            return(View());
        }
Exemplo n.º 3
0
        public ActionResult ChangePass(string oldPass, string newPass, string checkNewPass)
        {
            var           login    = SessionPersister.Login;
            var           adminAcc = _repoBl.GetAdmin(login);
            IHashProvider encoder  = new HashProvider();

            if (adminAcc.password != encoder.Encrypt(oldPass))
            {
                ViewBag.ChangePassValidate = "Старий пароль вказано не вірно";
            }
            else
            {
                _repoBl.ChangeAdminPass(login, newPass);
            }
            return(View());
        }