From 3baf3d2545ba6ece6b74a64c0def59bd0774cf54 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 10 Jun 2026 16:34:12 +0000
Subject: [PATCH] =Laid the groundwork for an improved DashboardManager.php setup. Have to put it aside so I can get the dang Northeh done though.

---
 inc/rest/routes/LoginRoutes.php |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/inc/rest/routes/LoginRoutes.php b/inc/rest/routes/LoginRoutes.php
index 2e863ee..b4563aa 100644
--- a/inc/rest/routes/LoginRoutes.php
+++ b/inc/rest/routes/LoginRoutes.php
@@ -136,18 +136,23 @@
 	 */
 	public function handleLogin(WP_REST_Request $request): WP_REST_Response
 	{
+		error_log('Handling login...');
 		$email = sanitize_email($request->get_param('user_email'));
 		$password = $request->get_param('user_password');
 		$remember = (bool) $request->get_param('remember_me');
 		$redirect_to = $request->get_param('redirect_to');
 
 		// Verify Turnstile
+
 		if (!$this->verifyTurnstile($request->get_param('cf-turnstile-response') ?? '')) {
+			error_log('[handleLogin]Turnstile failed');
 			return $this->error(
 				'Security verification failed. Please try again.',
 				'turnstile_failed',
 				403
 			);
+		} else {
+			error_log('[handleLogin]Turnstile succeeded');
 		}
 
 		// Attempt authentication
@@ -720,22 +725,20 @@
 	protected function buildAuth(?int $user = null): array
 	{
 		$userId = $user ?? (is_user_logged_in() ? get_current_user_id() : 0);
-		$cacheKey = $userId ?: 'guest';
 
-		return Cache::for('auth', 300)->remember($cacheKey, function() use ($userId) {
-			if ($userId) {
-				return [
-					'authenticated' => true,
-					'user'          => $userId,
-					'nonces'        => $this->getUserNonces($userId),
-				];
-			}
+		if ($userId) {
 			return [
-				'authenticated' => false,
-				'user'          => false,
-				'nonces'        => ['wp_rest' => wp_create_nonce('wp_rest')],
+				'authenticated' => true,
+				'user'          => $userId,
+				'nonces'        => $this->getUserNonces($userId),
 			];
-		});
+		}
+
+		return [
+			'authenticated' => false,
+			'user'          => false,
+			'nonces'        => ['wp_rest' => wp_create_nonce('wp_rest')],
+		];
 	}
 	protected function getUserNonces(int $userID):array {
 		$nonces = [
@@ -747,7 +750,7 @@
 		if (Site::has('favourites')) {
 			$nonces['favourites'] = wp_create_nonce('favourites-'.$userID);
 		}
-		if (!empty(Registrar::getFeatured('karma'))) {
+		if (!empty(Registrar::withFeature('karma'))) {
 			$nonces['votes'] = wp_create_nonce('votes-'.$userID);
 		}
 		if (Site::has('notifications')) {

--
Gitblit v1.10.0