Exemple #1
0
        public async Task <AuthResponse> ChangePasswordAsync(HttpContext context, string newPassword, string oldPassword)
        {
            var user = await context.AppUserFromContextAsync(UserManager);

            if (user == null)
            {
                return new AuthResponse
                       {
                           IsSuccess = false,
                           Errors    = new[] { "User does not exist" }
                       }
            }
            ;
            var identityResult = await UserManager.ChangePasswordAsync(user, oldPassword, newPassword);

            return(IdentityResultToAuthResponse(identityResult));
        }