示例#1
0
        protected override void Seed(DatabaseContext context)
        {
            User _user = new User()
            {
                Email        = "*****@*****.**".ToLower(),
                Password     = Sha.Encoder("admin123"),
                SecurityGuid = Guid.NewGuid()
            };

            context.Users.Add(_user);
            context.SaveChanges();
        }
示例#2
0
        public bool ChangeNewPassword(string password)
        {
            User _user = _manager.Find(u => u.UserID == 1);

            if (_user != null)
            {
                _user.Password = Sha.Encoder(password);
                _manager.Update(_user);
                return(true);
            }

            return(false);
        }
示例#3
0
        public bool LoginControl(User model)
        {
            User login = new User();

            login = _manager.Find(u => u.Email == model.Email);

            if (login != null)
            {
                if (Sha.Encoder(model.Password) == login.Password)
                {
                    return(true);
                }
            }

            return(false);
        }
示例#4
0
        public bool ChangePassword(string OldPassword, string password)
        {
            User u = _manager.Find(r => r.UserID == 1);

            if (Sha.Encoder(OldPassword) == u.Password)
            {
                u.Password = Sha.Encoder(password);
                int response = _manager.Update(u);

                if (response == 1)
                {
                    return(true);
                }

                return(false);
            }

            return(false);
        }