Пример #1
0
        public bool LoginAccount(string username, string password)
        {
            bool successfulLogin = false;

            AccountsConfig.account accountSelected = new AccountsConfig.account();
            foreach (AccountsConfig.account a in config.accounts)
            {
                //Disect the accounts and select an account
                if (a.username == username)
                {
                    accountSelected = a;
                }
            }

            if (accountSelected.username != null)
            {
                if (accountSelected.password == password)
                {
                    loggedAccount = accountSelected;
                    CustomConsole.SendLogType("Logged in", CustomConsole.MessageQuality.SUCESS);
                    successfulLogin = true;
                }
                else
                {
                    CustomConsole.SendLogType("Incorrect Password please try again", CustomConsole.MessageQuality.ERROR);
                    successfulLogin = false;
                }
            }
            else
            {
                CustomConsole.SendLogType("No account was found please retry", CustomConsole.MessageQuality.ERROR);
                successfulLogin = false;
            }
            return(successfulLogin);
        }
Пример #2
0
 public AccountsConfig.account getAccount(string username, string password)
 {
     AccountsConfig.account containAccount = new AccountsConfig.account();
     foreach (AccountsConfig.account a in config.accounts)
     {
         if (a.username == username)
         {
             containAccount = a;
         }
     }
     return(containAccount);
 }
Пример #3
0
        public void CreateAccount(string name, string password, bool autologin)
        {
            //Get the original object
            CustomConsole.SendLogType("Creating Account...", CustomConsole.MessageQuality.WARNING);
            List <AccountsConfig.account> accounts = config.accounts;

            AccountsConfig.account newaccount = new AccountsConfig.account();
            newaccount.username  = name;
            newaccount.password  = password;
            newaccount.autologin = autologin;
            accounts.Add(newaccount);
            config.SaveConfig();
            CustomConsole.SendLogType("Created Account!", CustomConsole.MessageQuality.SUCESS);
        }
Пример #4
0
 public void ExteriorLogin(AccountsConfig.account accountSelected)
 {
     if (accountSelected.autologin == true)
     {
         bool loginStatus = LoginAccount(accountSelected.username, accountSelected.password);
         if (loginStatus == false)
         {
             FirstLogin();
         }
     }
     else
     {
         //Ask for the password then login
         Console.WriteLine("password for " + accountSelected.username);
         string password    = Console.ReadLine();
         bool   loginStatus = LoginAccount(accountSelected.username, password);
         if (loginStatus == false)
         {
             FirstLogin();
         }
     }
 }
Пример #5
0
        public void ExteriorLogin(string username, string _password)
        {
            AccountsConfig.account accountSelected = new AccountsConfig.account();
            foreach (AccountsConfig.account a in config.accounts)
            {
                if (a.username == username && a.password == _password)
                {
                    accountSelected = a;
                }
            }

            if (accountSelected.autologin == true)
            {
                LoginAccount(accountSelected.username, accountSelected.password);
            }
            else
            {
                //Ask for the password then login
                Console.WriteLine("password for " + accountSelected.username);
                string password = Console.ReadLine();
                LoginAccount(accountSelected.username, password);
            }
        }