From 3d25ad7de4fdbb3eba2cde2a62422e6be5d79a0a Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 25 Aug 2026 22:57:22 +0000
Subject: [PATCH] =It's been a minute. I went through the Routes and associated Managers and ensured they played together well. Reworked the Cache.php, and I think I caught all the references. Moving away from JVBase() root class, to individuall classes that are Instanced. Double checked for the ABSPATH check in every file, and added index.php to every directory that didn't already have it. Also still working on the MenuBlock to work with WooCommerce for now for Northeh
---
inc/rest/routes/MagicLinkRoutes.php | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/inc/rest/routes/MagicLinkRoutes.php b/inc/rest/routes/MagicLinkRoutes.php
index 95addfd..417bba7 100644
--- a/inc/rest/routes/MagicLinkRoutes.php
+++ b/inc/rest/routes/MagicLinkRoutes.php
@@ -2,7 +2,7 @@
namespace JVBase\rest\routes;
use JVBase\rest\RestRouteManager;
-use JVBase\managers\MagicLinkManager;
+use JVBase\managers\MagicLinks;
use WP_REST_Request;
use WP_REST_Response;
use WP_Error;
@@ -12,6 +12,7 @@
}
/**
+ * @deprecated all bundled in with LoginRoutes.php
* Magic Link REST Routes
*
* Handles API endpoints for passwordless authentication
@@ -109,7 +110,7 @@
return $this->error('Security verification failed', 'turnstile_failed', 403);
}
$email = sanitize_email($request->get_param('email')??$request->get_param('user_email')??'');
- $type = sanitize_text_field($request->get_param('type')) ?? MagicLinkManager::TYPE_LOGIN;
+ $type = sanitize_text_field($request->get_param('type')) ?? MagicLinks::TYPE_LOGIN;
$context = $request->get_param('context') ?? [];
// Validate email
@@ -122,20 +123,20 @@
// Check if email exists
$exists = email_exists($email);
- if ($type === MagicLinkManager::TYPE_LOGIN && !$exists) {
+ if ($type === MagicLinks::TYPE_LOGIN && !$exists) {
return new WP_REST_Response([
'success' => true,
'message' => 'Invalid email address'
]);
}
- if ($type === MagicLinkManager::TYPE_SIGNUP && $exists) {
+ if ($type === MagicLinks::TYPE_SIGNUP && $exists) {
// Redirect to login instead
- $type = MagicLinkManager::TYPE_LOGIN;
+ $type = MagicLinks::TYPE_LOGIN;
}
// Send the magic link
- $result = JVB()->magicLink()?->sendMagicLink($email, $type, $context);
+ $result = MagicLinks::getInstance()?->sendMagicLink($email, $type, $context);
if (is_wp_error($result)) {
return new WP_REST_Response([
@@ -177,7 +178,7 @@
$email = sanitize_email($request->get_param('email'));
// This returns array|WP_Error - check for error first
- $token_data = JVB()->magicLink()?->verifyToken($token, $email);
+ $token_data = MagicLinks::getInstance()?->verifyToken($token, $email);
if (is_wp_error($token_data)) {
return new WP_REST_Response([
--
Gitblit v1.10.0