Exemplo n.º 1
0
        // this function forwards the input for validatoin check and for User class to login.
        // if the it passed all checks the user will be added to the logged in users hash table.
        public static InfoObject login(string email, string password)
        {
            InfoObject info;

            Log.Info("User: "******" log in attempt with password: "******"");
                }
                else
                {
                    Log.Error("This user doesn't exist. Wrong email or password.");
                    info = new InfoObject(false, "This user doesn't exist. Wrong email or password.");
                }
            }
            else
            {
                Log.Error("Login of " + email + " failed. Illegal password");
                info = new InfoObject(false, "Login of " + email + " failed. Illegal password");
            }
            return(info);
        }
 public void Test_NoSmallLetter()
 {
     email    = "*****@*****.**";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_InvalidEmailAdress()
 {
     email    = "sarah@gmail";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_NoDigit()
 {
     email    = "*****@*****.**";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_NoCapitalLetter()
 {
     email    = "*****@*****.**";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_PasswordNull()
 {
     email    = "*****@*****.**";
     password = null;
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_UserNull()
 {
     email    = null;
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_ShortPassword()   //Password < 4 characters
 {
     email    = "*****@*****.**";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_LongPassword()     //Password > 20 characters
 {
     email    = "*****@*****.**";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, false);
 }
 public void Test_ValidInput()
 {
     email    = "*****@*****.**";
     password = "******";
     output   = IsValid.IsValidUser(email, password);
     Assert.AreEqual(output, true);
 }
Exemplo n.º 11
0
        // tgus function forwards the inputs for validatoin check and for User class to register.
        public static InfoObject register(string email, string password)
        {
            InfoObject info;

            Log.Info("New user registration attempt. Email: " + email + ", password: "******"");
            }
            else
            {
                Log.Error("Invalid input. Registration failed.");
                info = new InfoObject(false, "Invalid input. Registration failed.");
            }
            return(info);
        }