public resultDto checkLogin(string username, string password) { HashBLL h = new HashBLL(); resultDto result = new resultDto(); var user = new UserBLL().getUserCredentials(username); if (user != null) { if (h.VerifyHash(password, user.Password)) { //login details are correct result.Pass = "******"; result.Role = user.Role; Session.Timeout = 30; Session["ID"] = user.ID; Session["UserName"] = user.Username; Session["Role"] = user.Role; } else result.Pass = "******"; } else result.Pass = "******"; return result; }
public void AddUser(string name, string surname, string idnumber, string address, string contactNumber, string email, string role, string username, string password) { DVDRentalEntities db = new DVDRentalEntities(); string hashPass = new HashBLL().CreateHash(password); User u = new User { Name = name, Surname = surname, IDNumber = idnumber, Address = address, ContactNumber = contactNumber, Email = email, Role = role, Username = username, Password = hashPass }; db.Users.Add(u); db.SaveChanges(); }