Browse Source
Remove `CurrentPassword` parameter.
pull/15708/head
maliming
3 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
4 additions and
6 deletions
-
modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AspNetIdentity/AbpResourceOwnerPasswordValidator.cs
-
modules/openiddict/src/Volo.Abp.OpenIddict.AspNetCore/Volo/Abp/OpenIddict/Controllers/TokenController.Password.cs
|
|
|
@ -125,7 +125,7 @@ public class AbpResourceOwnerPasswordValidator : IResourceOwnerPasswordValidator |
|
|
|
|
|
|
|
if (user.ShouldChangePasswordOnNextLogin) |
|
|
|
{ |
|
|
|
await HandleShouldChangePasswordOnNextLoginAsync(context, user); |
|
|
|
await HandleShouldChangePasswordOnNextLoginAsync(context, user, context.Password); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
@ -200,10 +200,9 @@ public class AbpResourceOwnerPasswordValidator : IResourceOwnerPasswordValidator |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task HandleShouldChangePasswordOnNextLoginAsync(ResourceOwnerPasswordValidationContext context, IdentityUser user) |
|
|
|
protected virtual async Task HandleShouldChangePasswordOnNextLoginAsync(ResourceOwnerPasswordValidationContext context, IdentityUser user, string currentPassword) |
|
|
|
{ |
|
|
|
var changePasswordToken = context.Request?.Raw?["ChangePasswordToken"]; |
|
|
|
var currentPassword = context.Request?.Raw?["CurrentPassword"]; |
|
|
|
var newPassword = context.Request?.Raw?["NewPassword"]; |
|
|
|
if (!changePasswordToken.IsNullOrWhiteSpace() && !currentPassword.IsNullOrWhiteSpace() && !newPassword.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -104,7 +104,7 @@ public partial class TokenController |
|
|
|
|
|
|
|
if (user.ShouldChangePasswordOnNextLogin) |
|
|
|
{ |
|
|
|
return await HandleShouldChangePasswordOnNextLoginAsync(request, user); |
|
|
|
return await HandleShouldChangePasswordOnNextLoginAsync(request, user, request.Password); |
|
|
|
} |
|
|
|
|
|
|
|
errorDescription = "You are not allowed to login! Your account is inactive or needs to confirm your email/phone number."; |
|
|
|
@ -215,10 +215,9 @@ public partial class TokenController |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task<IActionResult> HandleShouldChangePasswordOnNextLoginAsync(OpenIddictRequest request, IdentityUser user) |
|
|
|
protected virtual async Task<IActionResult> HandleShouldChangePasswordOnNextLoginAsync(OpenIddictRequest request, IdentityUser user, string currentPassword) |
|
|
|
{ |
|
|
|
var changePasswordToken = request.GetParameter("ChangePasswordToken")?.ToString(); |
|
|
|
var currentPassword = request.GetParameter("CurrentPassword")?.ToString(); |
|
|
|
var newPassword = request.GetParameter("NewPassword")?.ToString(); |
|
|
|
if (!changePasswordToken.IsNullOrWhiteSpace() && !currentPassword.IsNullOrWhiteSpace() && !newPassword.IsNullOrWhiteSpace()) |
|
|
|
{ |
|
|
|
|