Exemple #1
0
        public ActionResult Login(string username, string password)
        {
            try
            {
                DL.User u = loginFac.login(username, password);
                if (u != null)
                {
                    string userRole = loginFac.getUserRole(u.UserID);
                    setIdentityRole(username, userRole, u.UserID);
                    Session.Add(ConstantFields.userSession, u);
                    return(RedirectToAction("Index", "Home"));
                }
            }
            catch (Exception ex)
            {
                log.Error("Exception Login ", ex);
            }

            log.Error("Login failed for this user id " + username);
            this.AddNotification("Invalid username or password", NotificationType.ERROR);
            return(RedirectToAction("Index", "Login"));
        }
Exemple #2
0
 public void TestCorrectLogin()
 {
     Assert.AreEqual(users[0], facade.login("*****@*****.**", "test123"));
     Assert.AreEqual(users[1], facade.login("*****@*****.**", "test123"));
 }