public void ChangeUserPassword(int userId, string password) { User user = this.SearchUser(userId); user.Password = CypherService.CypherContentNoSalt(password); this.context.SaveChanges(); }
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(); }
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); } }