예제 #1
0
        public async Task<IdentityResult> ChangePassword(string userId, ChangePasswordModel changePasswordModel)
        {
            var result =
                await
                    _userManager.ChangePasswordAsync(userId, changePasswordModel.CurrentPassword,
                        changePasswordModel.Password);

            return result;
        }
예제 #2
0
        public async Task<IHttpActionResult> ChangePassword(ChangePasswordModel changePasswordModel)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var userId = HttpContext.Current.User.Identity.GetUserId();

            var result = await _repo.ChangePassword(userId, changePasswordModel);
            var errorResult = GetErrorResult(result);
            if (errorResult != null)
            {
                return errorResult;
            }

            return Ok();
        }