|
10 | 10 | * @package phpMyFAQ |
11 | 11 | * @author Thorsten Rinne <[email protected]> |
12 | 12 | * @author Jan Harms <[email protected]> |
13 | | - * @copyright 2012-2026 phpMyFAQ Team |
| 13 | + * @copyright 2008-2026 phpMyFAQ Team |
14 | 14 | * @license https://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0 |
15 | 15 | * @link https://www.phpmyfaq.de |
16 | | - * @since 2012-01-12 |
| 16 | + * @since 2008-01-25 |
17 | 17 | */ |
18 | 18 |
|
19 | 19 | declare(strict_types=1); |
@@ -90,4 +90,38 @@ public function bookmarks(Request $request): Response |
90 | 90 | 'csrfTokenDeleteAllBookmarks' => Token::getInstance($session)->getTokenString('delete-all-bookmarks'), |
91 | 91 | ]); |
92 | 92 | } |
| 93 | + |
| 94 | + /** |
| 95 | + * Displays the user registration page. |
| 96 | + * |
| 97 | + * @throws Exception |
| 98 | + * @throws \Exception |
| 99 | + */ |
| 100 | + #[Route(path: '/user/register', name: 'public.user.register')] |
| 101 | + public function register(Request $request): Response |
| 102 | + { |
| 103 | + if (!$this->configuration->get('security.enableRegistration')) { |
| 104 | + return new RedirectResponse($this->configuration->getDefaultUrl()); |
| 105 | + } |
| 106 | + |
| 107 | + $faqSession = $this->container->get('phpmyfaq.user.session'); |
| 108 | + $faqSession->setCurrentUser($this->currentUser); |
| 109 | + $faqSession->userTracking('registration', 0); |
| 110 | + |
| 111 | + $captcha = $this->container->get('phpmyfaq.captcha'); |
| 112 | + $captchaHelper = $this->container->get('phpmyfaq.captcha.helper.captcha_helper'); |
| 113 | + |
| 114 | + return $this->render('register.twig', [ |
| 115 | + ...$this->getHeader($request), |
| 116 | + 'title' => sprintf('%s - %s', Translation::get(key: 'msgRegistration'), $this->configuration->getTitle()), |
| 117 | + 'lang' => $this->configuration->getLanguage()->getLanguage(), |
| 118 | + 'isWebAuthnEnabled' => $this->configuration->get('security.enableWebAuthnSupport'), |
| 119 | + 'captchaFieldset' => $captchaHelper->renderCaptcha( |
| 120 | + $captcha, |
| 121 | + 'register', |
| 122 | + Translation::get(key: 'msgCaptcha'), |
| 123 | + $this->currentUser->isLoggedIn(), |
| 124 | + ), |
| 125 | + ]); |
| 126 | + } |
93 | 127 | } |
0 commit comments