Jake Vanderwerf
2026-08-25 3d25ad7de4fdbb3eba2cde2a62422e6be5d79a0a
inc/managers/Login.php
File was renamed from inc/managers/LoginManager.php
@@ -3,17 +3,19 @@
use JVBase\base\Site;
use JVBase\forms\TaxonomySelector;
use JVBase\meta\Form;
use JVBase\Instance;use JVBase\integrations\services\Cloudflare;use JVBase\meta\Form;
use JVBase\registrar\Registrar;use WP_Error;
use JVBase\registrar\Registrar;use JVBase\rest\routes\LoginRoutes;use WP_Error;
use WP_User;
if (!defined('ABSPATH')) {
   exit;
}
class LoginManager
class Login
{
   use Instance;
   protected ?Form $form = null;
   protected Cache $cache;
@@ -23,7 +25,6 @@
   protected array $fields = [];
   protected ?string $action = null;
   protected string $title = '';
   protected static LoginManager $instance;
   // Token handlers registry
   protected array $messageHandlers = [];
@@ -36,12 +37,13 @@
   ];
   private int $max_file_size = 5242880; // 5MB in bytes
   private LoginRoutes $routes;
   public function __construct()
   protected function __construct()
   {
      self::$instance = $this;
      $this->cache = Cache::for('login');
      $this->cache->flush();
      $this->routes = new LoginRoutes();
//    $this->cache = Cache::for('login');
//    $this->cache->flush();
      // Initialize magic link support if enabled
      if (Site::has('magic_link')) {
         $this->initMagicLinkSupport();
@@ -68,10 +70,6 @@
      add_action('user_register', [$this, 'saveRegistrationFields'], 50, 2);
      add_filter('the_seo_framework_sitemap_exclude_ids', [$this, 'excludeLoginSitemap'], 8, 1);
   }
   public static function getInstance():self
   {
      return self::$instance;
   }
   public function excludeLoginSitemap(array $ids): array
   {
@@ -378,15 +376,7 @@
         exit;
      }
      $this->setup();
      $page = $this->cache->remember(
            $this->getAction(),
            function() {
               return $this->renderPage();
            },
            5
         );
      echo $page;
      echo $this->renderPage();
      return '';
   }
   protected function renderPage() {
@@ -789,12 +779,12 @@
      if (!Site::hasIntegration('cloudflare')) {
         return;
      }
      JVB()->connect('cloudflare')->enqueueTurnstileScripts();
      Cloudflare::getInstance()->enqueueTurnstileScripts();
   }
   protected function verifyTurnstile(): bool
   {
      if (!Site::hasIntegration('cloudflare')) {
      if (!Site::hasIntegration('cloudflare') || Cloudflare::getInstance()->isSetUp()) {
         return true; // Not enabled, pass verification
      }
@@ -803,7 +793,7 @@
         return false;
      }
      return JVB()->connect('cloudflare')->verifyTurnstile($token);
      return Cloudflare::getInstance()->verifyTurnstile($token);
   }
   /************************************************************************
@@ -865,7 +855,7 @@
   protected function maybeMagicLink(): void
   {
      if (!JVB()->magicLink() || !in_array($this->action, ['login', 'lostpassword'])) {
      if (!MagicLinks::getInstance() || !in_array($this->action, ['login', 'lostpassword'])) {
         return;
      }
      ?>
@@ -1037,5 +1027,3 @@
   }
}
// Initialize the login manager
new LoginManager();