| | |
| | | $this->cacheTtl = WEEK_IN_SECONDS; |
| | | |
| | | parent::__construct(); |
| | | $this->hasMagicLink = Site::has('magic_link'); |
| | | |
| | | $this->hasMagicLink = Site::has('magicLink'); |
| | | } |
| | | |
| | | public function registerRoutes(): void |
| | |
| | | ->register(); |
| | | |
| | | // Magic link endpoint |
| | | if ($this->hasMagicLink) { |
| | | |
| | | if (Site::has('magic_link')) { |
| | | Route::for('auth/magic') |
| | | ->post([$this, 'handleMagicLink']) |
| | | ->args([ |
| | |
| | | */ |
| | | public function handleMagicLink(WP_REST_Request $request): WP_REST_Response |
| | | { |
| | | if (!$this->hasMagicLink) { |
| | | |
| | | if (!Site::has('magic_link')) { |
| | | return $this->error( |
| | | 'Magic link authentication is not enabled.', |
| | | 'feature_disabled', |