Exemplo n.º 1
0
        public bool checkUser(string _password, string _username)
        {
            MyFileHandler file_handler  = new MyFileHandler(_username);
            string        username_path = "./account_list/" + _username;

            if (file_handler.CheckDirectory(username_path))
            {
                string   password_path    = "./account_list/" + _username + "/key.txt";
                string[] fetched_password = File.ReadAllLines(password_path);

                if (_password == fetched_password[0])
                {
                    Console.Clear();

                    //Console.WriteLine("Log in Successfully! ");
                    //Console.ReadLine();
                    //Console.Clear();

                    file_handler.WriteToFile("./account_list./active_user.txt", _username);
                    return(false);
                }
                else
                {
                    error_message("password");
                    return(true);
                }
            }
            else
            {
                error_message("username");
                return(true);
            }
        }
Exemplo n.º 2
0
        public bool CheckRecoveryInfo(string username)
        {
            var    file_handler  = new MyFileHandler(username);
            string username_path = "./account_list/" + username;

            if (file_handler.CheckDirectory(username_path))
            {
                string recovery_question_path    = "./account_list/" + username + "/recovery_question.txt";
                string fetched_recovery_question = file_handler.ReadFile(recovery_question_path);

                RecoveryMode(username, fetched_recovery_question);

                return(false);
            }
            else
            {
                Console.WriteLine("Username is unrecognize...\nPlease try again...");
                Console.ReadLine();
                return(true);
            }
        }