using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StartMenu
{
internal class createuser
{
private string userName { get; set; }
private string password { get; set; }
public createuser()
{
Console.WriteLine("Hello welcome to the register system");
Console.WriteLine("Please enter your user name");
userName = Console.ReadLine();
createpassword();
}
public static void Login(createuser newUser)
{
string userinput;
string passwordinput;
Console.WriteLine("Hello. To login please enter your username.");
userinput = Console.ReadLine();
Console.WriteLine("Please enter your password.");
passwordinput = Console.ReadLine();
if (userinput == newUser.userName && passwordinput == newUser.password)
{
Console.WriteLine($"System access granted. Hello {newUser.userName}");
}
else if(userinput == newUser.userName && passwordinput != newUser.password)
{
Console.WriteLine("Incorrect password.");
}
else
{
Console.WriteLine("Sorry that user does not exist");
}
}
private void createpassword()
{
Console.WriteLine("Please enter a password.");
password = Console.ReadLine();
Console.Clear();
string newpassword = new string('*', password.Length);
Console.WriteLine($"Your Username: {userName}");
Console.WriteLine($"Your password: {newpassword}");
Console.WriteLine("Please press any key to continue.");
Console.ReadKey();
Console.Clear();
Program.mainMenu();
}
public static void changePass(createuser newUser)
{
Console.WriteLine("please type your old password.");
var passcha = Console.ReadLine();
if (passcha == newUser.password)
{
Console.WriteLine("Please type your new Password");
string newpass = Console.ReadLine();
newUser.password = newpass;
Console.WriteLine($"Your new password is {newUser.password}");
Console.WriteLine("Press any key to continue.");
Console.ReadKey();
Console.Clear();
Program.userMenu();
}
}
public static void userInfo(createuser newUser)
{
string newpassword = new string('*', newUser.password.Length);
Console.WriteLine($"Your User Name is: {newUser.userName}");
Console.WriteLine($"Your Password is: {newpassword}");
Console.WriteLine("Press any Key to return to menu.");
Console.ReadKey();
}
}
}