Exemplo n.º 1
0
        public void ChangeUserPassword(int userId, string password)
        {
            User user = this.SearchUser(userId);

            user.Password = CypherService.CypherContentNoSalt(password);
            this.context.SaveChanges();
        }
Exemplo n.º 2
0
 public void CreateUser(User user)
 {
     user.UserId = this.GetNextId("user");
     //user.Salt = CypherService.GetSalt();
     user.Password = CypherService.CypherContentNoSalt(user.PasswordString /*, user.Salt*/);
     user.Role     = "NormalUser";
     this.context.User.Add(user);
     this.context.SaveChanges();
 }
Exemplo n.º 3
0
        public User ExisteUsuario(string username, string password)
        {
            User user = this.context.User.Where(x => x.Username == username).FirstOrDefault();

            //String salt = user.Salt;
            byte[] passbbdd     = user.Password;
            byte[] passtemporal =
                CypherService.CypherContentNoSalt(password /*, salt*/);
                        //COMPARAR ARRAY BYTES[]
                        bool respuesta = HelperToolkit.CompararArrayBytes(passbbdd, passtemporal);

            if (respuesta == true)
            {
                return(user);
            }
            else
            {
                return(null);
            }
        }