diff options
author | vnugent <public@vaughnnugent.com> | 2023-01-27 21:13:16 -0500 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2023-01-27 21:13:16 -0500 |
commit | 7217f918969ed9049c9703bffc2e214c2717207b (patch) | |
tree | 5659fda20f008234c50eeaf24d88d8463fade1e7 /plugins/VNLib.Plugins.Essentials.Accounts/src | |
parent | 1311f0f5f20c77e5dfc315c84899a3c049ff2b2c (diff) |
Object cache overhaul and logger updates
Diffstat (limited to 'plugins/VNLib.Plugins.Essentials.Accounts/src')
-rw-r--r-- | plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PasswordResetEndpoint.cs | 5 | ||||
-rw-r--r-- | plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PasswordResetEndpoint.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PasswordResetEndpoint.cs index 0a51eb5..be109d1 100644 --- a/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PasswordResetEndpoint.cs +++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PasswordResetEndpoint.cs @@ -66,16 +66,19 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints ValErrWebMessage webm = new(); //get the request body using JsonDocument? request = await entity.GetJsonFromFileAsync(); + if (request == null) { webm.Result = "No request specified"; entity.CloseResponseJson(HttpStatusCode.BadRequest, webm); return VfReturnType.VirtualSkip; } + //get the user's old password using PrivateString? currentPass = (PrivateString?)request.RootElement.GetPropString("current"); //Get password as a private string using PrivateString? newPass = (PrivateString?)request.RootElement.GetPropString("new_password"); + if (PrivateString.IsNullOrEmpty(currentPass)) { webm.Result = "You must specifiy your current password."; @@ -88,6 +91,7 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints entity.CloseResponseJson(HttpStatusCode.UnprocessableEntity, webm); return VfReturnType.VirtualSkip; } + //Test the password against minimum if (!AccountValidations.PasswordValidator.Validate((string)newPass, webm)) { @@ -99,6 +103,7 @@ namespace VNLib.Plugins.Essentials.Accounts.Endpoints entity.CloseResponse(webm); return VfReturnType.VirtualSkip; } + //get the user's entry in the table using IUser? user = await Users.GetUserAndPassFromIDAsync(entity.Session.UserID); if(webm.Assert(user != null, "An error has occured, please log-out and try again")) diff --git a/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs b/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs index ee623e2..f8d322b 100644 --- a/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs +++ b/plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs @@ -211,7 +211,7 @@ namespace VNLib.Plugins.Essentials.Accounts.MFA MFAConfig mfa = new(conf); //Recover secret from config and dangerous 'lazy load' - _ = pbase.DeferTask(async () => + _ = pbase.ObserveTask(async () => { mfa.MFASecret = await pbase.TryGetSecretAsync("mfa_secret").ToJsonWebKey(); |