Exemplo n.º 1
0
        public ActionResult ChangePasswordPost(ChangePasswordModel model)
        {
            var user = _usersService.GetById(UserId);

            if (user.PasswordHash != _cryptoHelper.GetPasswordHash(model.OldPassword, user.PasswordSalt))
            {
                ModelState.AddModelError("OldPassword", "Old password is incorrect.");
            }
            if (ModelState.IsValid)
            {
                var cmd = new ChangePassword
                {
                    Id          = user.Id,
                    NewPassword = model.NewPassword,
                };
                Send(cmd);
                return(Redirect("/"));
            }
            return(View("ChangePassword", model));
        }
Exemplo n.º 2
0
        public ActionResult MyAvatar()
        {
            var user = _users.GetById(UserId);

            return(Json(new { avatarUrl = AvatarsService.GetUrlById(user.AvatarId) }));
        }