Exemple #1
0
        public User Login()
        {
            userIO.CenterText(userIO.zwitterAscii);
            userIO.PadLeft("Login\n", 2, ConsoleColor.Cyan);
            UpdateSearchLists();

            userIO.PadLeft("Enter Email", 2);
            string eMail = userIO.GetUserString();
            User   user  = GetUserByEmail(eMail);

            if (!CheckEmailInSystem(eMail))
            {
                userIO.PadLeft("Email not found. Press enter to continue.", 2, ConsoleColor.DarkYellow);
                Console.ReadLine();
                return(user);
            }

            userIO.PadLeft("Enter Password", 2);
            string password = GetPassword();

            //check if email and pass are correct
            if (password != user.Password)
            {
                userIO.PadLeft("Password incorrect, press enter to continue", 2, ConsoleColor.DarkRed);
                Console.ReadLine();
                return(user);
            }

            user.LoggedIn = true;
            LoadUserPosts(user);
            return(user);
        }
Exemple #2
0
        private string GetPostContent()
        {
            userIO.CenterText(userIO.zwitterAscii);

            userIO.PadLeft("What's happening?", 2, ConsoleColor.DarkCyan);
            string content = userIO.GetUserString();

            if (content.Length > 95)
            {
                userIO.PadLeft("Zweet has max of 80 characters! It will be cut! Press enter to continue", 2, ConsoleColor.DarkRed);
                Console.ReadLine();
                content = content.Substring(0, 80);
            }
            return(content);
        }