aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar vnugent <public@vaughnnugent.com>2023-01-27 21:13:16 -0500
committerLibravatar vnugent <public@vaughnnugent.com>2023-01-27 21:13:16 -0500
commit7217f918969ed9049c9703bffc2e214c2717207b (patch)
tree5659fda20f008234c50eeaf24d88d8463fade1e7
parent1311f0f5f20c77e5dfc315c84899a3c049ff2b2c (diff)
Object cache overhaul and logger updates
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/Endpoints/PasswordResetEndpoint.cs5
-rw-r--r--plugins/VNLib.Plugins.Essentials.Accounts/src/MFA/UserMFAExtensions.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/Auth0.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/DiscordOauth.cs2
-rw-r--r--plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/GitHubOauth.cs2
5 files changed, 9 insertions, 4 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();
diff --git a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/Auth0.cs b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/Auth0.cs
index 586ef96..3466ad0 100644
--- a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/Auth0.cs
+++ b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/Auth0.cs
@@ -70,7 +70,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
InitPathAndLog(Config.EndpointPath, plugin.Log);
//Load secrets
- _ = plugin.DeferTask(async () =>
+ _ = plugin.ObserveTask(async () =>
{
//Get id/secret
Task<SecretResult?> secretTask = plugin.TryGetSecretAsync("auth0_client_secret");
diff --git a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/DiscordOauth.cs b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/DiscordOauth.cs
index 441dd9d..a701bdf 100644
--- a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/DiscordOauth.cs
+++ b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/DiscordOauth.cs
@@ -57,7 +57,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
InitPathAndLog(Config.EndpointPath, plugin.Log);
//Load secrets
- _ = plugin.DeferTask(async () =>
+ _ = plugin.ObserveTask(async () =>
{
//Get id/secret
Task<SecretResult?> clientIdTask = plugin.TryGetSecretAsync("discord_client_id");
diff --git a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/GitHubOauth.cs b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/GitHubOauth.cs
index 676f2bb..7e8c576 100644
--- a/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/GitHubOauth.cs
+++ b/plugins/VNLib.Plugins.Essentials.SocialOauth/src/Endpoints/GitHubOauth.cs
@@ -64,7 +64,7 @@ namespace VNLib.Plugins.Essentials.SocialOauth.Endpoints
InitPathAndLog(Config.EndpointPath, plugin.Log);
//Load secrets
- _ = plugin.DeferTask(async () =>
+ _ = plugin.ObserveTask(async () =>
{
//Get id/secret
Task<SecretResult?> clientIdTask = plugin.TryGetSecretAsync("github_client_id");