Esempio n. 1
0
        public ActionResult LogOn(UserAuthentication value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            value.Validate();

            if (value.IsValid)
            {
                var user = this.UserService.GetBy(new UserEmailAddressSpecification(value.EmailAddress));

                this.AuthenticationService.LogOn(user);

                ApplicationSession.Destroy(this.Session);

                var url = value.Redirect;

                if (base.Url.IsLocalUrl(url))
                {
                    return base.Redirect(url);
                }

                return base.RedirectToRoute(CommonRoutes.Index);
            }

            value.CopyToModel(ModelState);

            return base.View(Views.LogOn, value);
        }