コード例 #1
0
        public static void Login()
        {
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.WriteLine("Hello Kanban user! Please enter your email and password.");
            Console.ResetColor();
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("NOTE : In order to go back to the menu, press '-1'\n");
            Console.ResetColor();
            Console.Write("Email : ");
            string email = Console.ReadLine();

            if (email != "-1")
            {
                if (kanban.IsValidEmail(email))
                {
                    if (!(kanban.IsUniqueEmail(email)))
                    {
                        Console.Write("Password : "******"-1")
                        {
                            if (kanban.LogIn(email, password))//password and email are in the system;
                            {
                                Console.WriteLine("");
                                Console.ForegroundColor = ConsoleColor.Green;
                                Console.WriteLine("Logeed in successfully!\n");
                                Console.ResetColor();
                                Console.ForegroundColor = ConsoleColor.Red;
                                Log.Info("User with email " + email + " logged in.");
                                Console.ResetColor();
                                PrintBoard();
                                UserOption();
                            }
                            else
                            {
                                Console.ForegroundColor = ConsoleColor.Red;
                                Log.Error("Password do not match to user.");
                                Console.WriteLine("Login failed! Your password is incorrect.\n");
                                Console.ResetColor();
                                Login();
                            }
                        }
                        else //if the user wants to go back to menu
                        {
                            Start();
                        }
                    }
                    else //if the email isnt in the system
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Log.Warn("Email address does not exist in the system.");
                        Console.WriteLine("Please enter a valid email!\n");
                        Console.ResetColor();
                        Login();
                    }
                }
                else
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    Log.Warn("Invalid input: Email address isnt legit.");
                    Console.WriteLine("Please enter a valid email adress.\n");
                    Console.ResetColor();
                    Login();
                }
            }
            else // the user wants to go back to menu
            {
                Start();
            }
        }
コード例 #2
0
 public bool LogIn(string email, string password)
 {
     return(kanban.LogIn(email, password));
 }
コード例 #3
0
 public bool Login()
 {
     return(kanban.LogIn(email, password));
 }