Exemplo n.º 1
0
        public LoginAttemptViewModel Login(LoginAttemptViewModel attempt)
        {
            var output = new LoginAttemptViewModel();

            if (attempt.Username == "asdf" && attempt.Password == "asdf")
            {
                _authContext.ThisUserHasBeenAuthenticated(attempt.Username, false);
                output.RedirectTo(_resolver.PrimaryApplicationUrl());
            }
            else
            {
                output.Error    = "Invalid username or password";
                output.Password = null;
                _flash.Flash(output);
                output.RedirectTo <LoginController>(c => c.Index(null));
            }
            return(output);
        }