From 42fa8304ddb811b0f725f245130f70c0f5e86a6c Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 04 Nov 2025 06:12:02 +0000
Subject: [PATCH] =Refactored LoginManager to be more extensible and configurable, as well as an AjaxRateLimiter

---
 inc/rest/routes/Invitations.php |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/inc/rest/routes/Invitations.php b/inc/rest/routes/Invitations.php
index 401cb07..1372cb4 100644
--- a/inc/rest/routes/Invitations.php
+++ b/inc/rest/routes/Invitations.php
@@ -48,6 +48,23 @@
         // Add hooks for processing accepted invitations
         add_action('user_register', [$this, 'checkInvitation'], 10, 1);
 
+		add_action('jvbLoginManagerInit', function($loginManager) {
+			$loginManager->registerTokenHandler('invite', function($token, $email, $user_id) {
+				JVB()->routes('invites')->acceptInvitation($token, $email, $user_id);
+			});
+
+			$loginManager->registerMessageHandler('invitation',
+				function() {
+					return '<h2>You\'ve been invited!</h2><p>Create your account to accept.</p>';
+				},
+				function() {
+					return isset($_GET['invite']);
+				}
+			);
+		});
+
+
+
         add_action('jvb_daily_maintenance', [$this, 'cleanupExpiredInvitations']);
 
         // Add filter for bulk operation handling

--
Gitblit v1.10.0