Exemplo n.º 1
0
        public ActionResult RequestUnlock(LoginModel loginModel)
        {
            // todo: Create a new interface and method IUserService.GetUserByLogin(string username) have it return an object with UserId, Username and Email.

            // todo: Send email with url to UnlockUser action and include a Guid that can be tied to the user account being reset.  The Guid should expire after ???

            // todo: Redirect to new view and display a message that email has been sent.
            throw new NotImplementedException();
        }
Exemplo n.º 2
0
        public ActionResult Login(LoginModel loginModel, string returnUrl)
        {
            if (loginModel == null) return View("Index");

            AuthenticationToken token = _mappingEngine.Map<AuthenticationToken>(loginModel);

            if (!_authenticationService.AuthenticateUser(token))
            {
                loginModel.ErrorMessage = AccountResources.InvalidLogin;
                return View("Index", loginModel);
            }

            _formsFormsAuthentication.SetAuthCookie(loginModel.Username, false);

            if (returnUrl == null) return RedirectToAction("Index", "Home");

            return new RedirectResult(returnUrl);
        }