Ejemplo n.º 1
0
 public ActionResult Logout()
 {
     try
     {
         SessionId sessionId = new SessionId(HttpContext.Session.SessionID);
         UserContext.Logout();
         return Json(new { result = "Redirect", url = Url.Action("", "") });
     }
     catch (AutenticationException ex)
     {
         return Json(new { result = "Error", message = ex.Message });
     }
 }
Ejemplo n.º 2
0
 public ActionResult Login(string username, string password)
 {
     try
     {
         SessionId sessionId = new SessionId(HttpContext.Session.SessionID);
         Tiskarna.TiskarnaVosahlo.Autentication.LogIn(sessionId, username, password);
         return Json(new { result = "Redirect", url = Url.Action("Home", "Home") });
     }
     catch (AutenticationException ex)
     {
         return Json(new { result = "Error", message = ex.Message });
     }
 }
Ejemplo n.º 3
0
        public void LogIn(SessionId sessionId, String username, String password)
        {
            try
            {
                IUser user = GetUser(username, password);
                IRights rights = GetRights(user);

                if (UserContext.SessionId != SessionId.Empty)
                {
                    UserContext.Logout();
                }

                UserContext.Login(sessionId, user, rights);
            }
            catch (Exception)
            {
                UserContext.Logout();
                throw;
            }
        }