示例#1
0
        public ActionResult Login(LoginViewModel input)
        {
            var notification = new Notification {Message = WebLocalizationKeys.INVALID_USERNAME_OR_PASSWORD.ToString()};

            try
            {
                if (input.HasCredentials())
                {
                    var redirectUrl = string.Empty;
                    var user = _securityDataService.AuthenticateForUserId(input.UserName, input.Password);
                    if (user != null)
                    {
                        redirectUrl = _authenticationContext.ThisUserHasBeenAuthenticated(user, input.RememberMe);
                        notification.Success = true;
                        notification.Message = string.Empty;
                        notification.Redirect = true;
                        notification.RedirectUrl = redirectUrl;
                    }
                }
            }
            catch (Exception ex)
            {
                notification = new Notification { Message = WebLocalizationKeys.ERROR_UNEXPECTED.ToString() };
                ex.Source = "CATCH RAISED";
                Elmah.ErrorSignal.FromCurrentContext().Raise(ex);
            }
            return Json(notification);
        }
示例#2
0
 public ActionResult Login()
 {
     var loginViewModel = new LoginViewModel
                              {
                                  Title = WebLocalizationKeys.REGISTER_FOR_DECISION_CRITICAL.ToString(),
                              };
     return View(loginViewModel);
 }
示例#3
0
        //            
        //            if (input.HasCredentials())
        //            {
        //                var user = _securityDataService.AuthenticateForUserId(input.UserName, input.Password);
        //                if(user!=null)
        //                {
        //                    var redirectUrl = _authenticationContext.ThisUserHasBeenAuthenticated(user, false);
        //                    return Redirect(redirectUrl);
        //                }
        //            }
        //            return Json(notification);
        //      }
        public ActionResult Log_in(LoginViewModel input)
        {
            var user = _repository.Find<User>(input.EntityId);
            if(user.UserLoginInfo.ByPassToken!=input.Guid)
            {
                return RedirectToAction("Login");
            }
            var redirectUrl = _authenticationContext.ThisUserHasBeenAuthenticated(user,false);
            user.UserLoginInfo.ByPassToken = Guid.Empty;
            var crudManager = _saveEntityService.ProcessSave(user);
            crudManager.Finish();

            return Redirect(redirectUrl);
        }