public void Test_UserAuthenticationUpdate_Validate()
        {
            var value = new UserAuthenticationUpdate();

            value.Validate();

            Assert.AreEqual(4, value.Errors.Count, "Errors");
        }
Esempio n. 2
0
        public ActionResult Update(UserAuthenticationUpdate value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var user = this.UserService.GetById(Identity.Id);

            if (user == null)
            {
                return base.HttpNotFound();
            }

            value.Validate();

            if (value.IsValid)
            {
                this.AuthenticationService.Update(user, value.NewPassword);
                this.AuthenticationService.LogOff();

                return base.RedirectToRoute(UsersRoutes.AuthLogOn);
            }

            value.CopyToModel(ModelState);

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