| @@ -28,8 +28,19 @@ | ||
| 28 | 28 | add_action('wp_ajax_fcom_user_registration', [$this, 'handleUserSignup']); |
| 29 | 29 | add_action('wp_ajax_nopriv_fcom_user_login_form', [$this, 'handleUserLogin']); |
| 30 | 30 | add_action('wp_ajax_fcom_user_login_form', [$this, 'handleUserLogin']); |
| 31 | 31 | |
| 32 | + /* | |
| 33 | + * Declared here rather than where the auth screen renders, because the form that | |
| 34 | + * screen draws posts back to admin-ajax and that is a different request: nothing | |
| 35 | + * survives into it but what the browser sent. FluentAuth answers those posts only | |
| 36 | + * for a host it already knows about. | |
| 37 | + * | |
| 38 | + * `is_fcom_auth` is the field the login form has always carried; FluentAuth's own | |
| 39 | + * signed marker travels on the rest. | |
| 40 | + */ | |
| 41 | + AuthHelper::registerWithFluentAuth(); | |
| 42 | + | |
| 32 | 43 | add_filter('fluent_auth/login_redirect_url', function ($redirectUrl, $user) { |
| 33 | 44 | if (empty($_REQUEST['is_fcom_auth']) || empty($_REQUEST['fcom_redirect'])) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended |
| 34 | 45 | return $redirectUrl; |
| 35 | 46 | } |
| @@ -190,8 +201,18 @@ | ||
| 190 | 201 | $targetForm = 'accept_invitation'; |
| 191 | 202 | } |
| 192 | 203 | } |
| 193 | 204 | |
| 205 | + /* | |
| 206 | + * Hand the screen to FluentAuth before asking whether it is available: adopting | |
| 207 | + * is what makes it so. Its front end forms sit behind a site setting meant for | |
| 208 | + * whether an editor may drop the shortcode into a page, and reading that as | |
| 209 | + * "may this portal use FluentAuth" is what used to drop us onto a login form of | |
| 210 | + * our own while FluentAuth went on injecting magic login and enforcing a second | |
| 211 | + * factor against a DOM it no longer recognised. | |
| 212 | + */ | |
| 213 | + AuthHelper::adoptFluentAuth(); | |
| 214 | + | |
| 194 | 215 | $isFluentAuth = AuthHelper::isFluentAuthAvailable(); |
| 195 | 216 | if (!$isFluentAuth && $targetForm == 'reset_password') { |
| 196 | 217 | $this->safeRedirectAndExit(wp_lostpassword_url(Helper::baseUrl())); |
| 197 | 218 | } |
| @@ -449,8 +470,9 @@ | ||
| 449 | 470 | ], 422); |
| 450 | 471 | } |
| 451 | 472 | |
| 452 | 473 | $data['email'] = sanitize_email($data['email']); |
| 474 | + $data['full_name'] = sanitize_text_field(Arr::get($data, 'full_name', '')); | |
| 453 | 475 | |
| 454 | 476 | $validations = [ |
| 455 | 477 | 'full_name' => 'required|max:100|string', |
| 456 | 478 | 'username' => 'required|unique:users,user_login|unique:fcom_xprofile,username|min:4|max:30', |