/// <summary> /// Requests a log in for the user. /// </summary> private bool LogIn() { Console.Write("Username: "******"Password: "); string password = Console.ReadLine(); if (Password_Hasher.Verify(password, UserBusiness.GetUser(UserBusiness.GetID(username)).Password)) { return(true); } return(false); }
/// <summary> /// Requests a register of a new user. /// </summary> private void Register() { Console.Write("Username: "******"Password: "); string password = Console.ReadLine(); string hashed_pass = Password_Hasher.Hash(password); if (!Password_Hasher.Verify(password, hashed_pass)) { return; } UserBusiness.Register(username, hashed_pass); }
public ActionResult Verify(string username, string password) { using (Context _context = new Context()){ User result = _context.Users.ToList().Find(x => x.Username == username); if (!Password_Hasher.Verify(password, result.Password) || !result.Active) { //TODO: Create Exception return(View("~/Views/Home/Index.cshtml")); } SharedData.logged = result; return(View("Home")); } }
/// <summary> /// Requests a user to be removed. /// </summary> private void RemoveUser() { Console.Clear(); Console.WriteLine(new string('-', 40)); Console.WriteLine(new string(' ', 14) + "USER REMOVAL"); Console.WriteLine(new string('-', 40) + '\n'); for (int i = 0; i < 4; i++) { Console.Write("Password: "******"The password you have entered is incorrect\nTry again! {i + 1}/4\n"); } }