forked from collabvm/CollabVMAuthServer
fix bug where password can become blank
This commit is contained in:
parent
13c6261915
commit
f262646dba
1 changed files with 4 additions and 4 deletions
|
@ -66,7 +66,7 @@ public static class Routes
|
||||||
}, Utilities.JsonSerializerOptions);
|
}, Utilities.JsonSerializerOptions);
|
||||||
}
|
}
|
||||||
// Validate new username
|
// Validate new username
|
||||||
if (!string.IsNullOrWhiteSpace(payload.username))
|
if (payload.username != null)
|
||||||
{
|
{
|
||||||
if (!Utilities.ValidateUsername(payload.username))
|
if (!Utilities.ValidateUsername(payload.username))
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ public static class Routes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Validate new E-Mail
|
// Validate new E-Mail
|
||||||
if (!string.IsNullOrWhiteSpace(payload.email))
|
if (payload.email != null)
|
||||||
{
|
{
|
||||||
if (!new EmailAddressAttribute().IsValid(payload.email))
|
if (!new EmailAddressAttribute().IsValid(payload.email))
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ public static class Routes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Validate new password
|
// Validate new password
|
||||||
if (!string.IsNullOrWhiteSpace(payload.newPassword))
|
if (payload.newPassword != null)
|
||||||
{
|
{
|
||||||
if (!Utilities.ValidatePassword(payload.newPassword))
|
if (!Utilities.ValidatePassword(payload.newPassword))
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ public static class Routes
|
||||||
}
|
}
|
||||||
// Check for duplicate changes
|
// Check for duplicate changes
|
||||||
if (payload.username == user.Username || payload.email == user.Email ||
|
if (payload.username == user.Username || payload.email == user.Email ||
|
||||||
Argon2.Verify(user.Password, payload.newPassword))
|
(payload.newPassword != null && Argon2.Verify(user.Password, payload.newPassword)))
|
||||||
{
|
{
|
||||||
return Results.Json(new UpdateResponse
|
return Results.Json(new UpdateResponse
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue