diff --git a/app/Hooks/Handlers/LoginCustomizerHandler.php b/app/Hooks/Handlers/LoginCustomizerHandler.php index 64d8425..4ecf896 100644 --- a/app/Hooks/Handlers/LoginCustomizerHandler.php +++ b/app/Hooks/Handlers/LoginCustomizerHandler.php @@ -178,16 +178,24 @@ public function addExtendedRegFields() $policyUrl = apply_filters('fluent_auth/signup_policy_url', $policyUrl); // We will add the custom fields here - $fullName = Arr::get($_POST, 'user_full_name', ''); + $firstName = Arr::get($_POST, 'first_name', ''); + $lastName = Arr::get($_POST, 'last_name', ''); $password = Arr::get($_POST, 'user_password', ''); $confirmPassword = Arr::get($_POST, 'user_confirm_password', ''); $agreeTerms = Arr::get($_POST, 'agree_terms', ''); ?> -
- - +
+ + +
++ +
-@@ -237,11 +245,8 @@ public function maybeInterceptRegistration(\WP_Error $errors, $sanitized_user_lo $errors->add('confirm_token', sprintf(__('A verification code has been sent to %s. Please provide the code below:', 'fluent-security'), $user_email)); - $fullName = Arr::get($_POST, 'user_full_name', ''); - - $nameArr = explode(' ', $fullName); - $firstName = array_shift($nameArr); - $lastName = implode(' ', $nameArr); + $firstName = Arr::get($_POST, 'first_name', ''); + $lastName = Arr::get($_POST, 'last_name', ''); $formData = [ 'email' => $user_email, @@ -297,10 +302,8 @@ public function maybeIntercept2FaRegistration($sanitized_user_login, $user_email return false; } - $fullName = Arr::get($_POST, 'user_full_name', ''); - $fullNameArr = explode(' ', $fullName); - $firstName = array_shift($fullNameArr); - $lastName = implode(' ', $fullNameArr); + $firstName = Arr::get($_POST, 'first_name', ''); + $lastName = Arr::get($_POST, 'last_name', ''); $formData = [ 'username' => $sanitized_user_login, @@ -358,26 +361,20 @@ private function validateRegistrationData($data) { $errors = new \WP_Error(); - if (!empty($data['first_name'])) { - $data['user_full_name'] = trim(Arr::get($data, 'first_name') . ' ' . Arr::get($data, 'last_name')); - } - - if (empty($data['user_full_name'])) { - $errors->add('user_full_name', __('Please enter your full name.', 'fluent-security')); - } - - $fullName = Arr::get($data, 'user_full_name', ''); + $firstName = trim(Arr::get($data, 'first_name', '')); - // check if the name is valid - // Consider if there has any special characters like +, -, *, /, etc - // only check the +,-,*,$,/,=,%,!,@,#,^,&,*,(,),_,{,},[,],:,;,',",<,>,?,|,`,~,, - if (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/u', $fullName)) { - $errors->add('user_full_name', __('Please provide a full name.', 'fluent-security')); + if (empty($firstName)) { + $errors->add('first_name', __('Please enter your first name.', 'fluent-security')); + } elseif (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/u', $firstName)) { + $errors->add('first_name', __('Invalid characters in first name.', 'fluent-security')); } - // check if there has any http or https - if (preg_match('/http|https/', $fullName)) { - $errors->add('user_full_name', __('Please provide a valid name.', 'fluent-security')); + // Validate last name + $lastName = trim(Arr::get($data, 'last_name', '')); + if (empty($lastName)) { + $errors->add('last_name', __('Please enter your last name.', 'fluent-security')); + } elseif (preg_match('/[\'^£$%&*()}{@#~?><>,|=_+¬-]/u', $lastName)) { + $errors->add('last_name', __('Invalid characters in last name.', 'fluent-security')); } if (empty($data['user_password'])) { diff --git a/app/Services/AuthService.php b/app/Services/AuthService.php index 323e8dd..ef51ea1 100644 --- a/app/Services/AuthService.php +++ b/app/Services/AuthService.php @@ -85,17 +85,6 @@ private static function maybeUpdateUser($user, $userData) } if (!$user->first_name || !$user->last_name) { - if (!empty($userData['full_name'])) { - // extract the names - $fullNameArray = explode(' ', $userData['full_name']); - $updateData['first_name'] = array_shift($fullNameArray); - if ($fullNameArray) { - $updateData['last_name'] = implode(' ', $fullNameArray); - } else { - $updateData['last_name'] = ''; - } - } - if (!empty($userData['first_name'])) { $updateData['first_name'] = $userData['first_name']; } @@ -194,18 +183,6 @@ public static function registerNewUser($user_login, $user_email, $user_pass = '' $data['last_name'] = sanitize_text_field($extraData['last_name']); } - if (!empty($extraData['full_name']) && empty($extraData['first_name']) && empty($extraData['last_name'])) { - $extraData['full_name'] = sanitize_text_field($extraData['full_name']); - // extract the names - $fullNameArray = explode(' ', $extraData['full_name']); - $data['first_name'] = array_shift($fullNameArray); - if ($fullNameArray) { - $data['last_name'] = implode(' ', $fullNameArray); - } else { - $data['last_name'] = ''; - } - } - if (!empty($extraData['description'])) { $data['description'] = sanitize_textarea_field($extraData['description']); } diff --git a/mix-manifest.json b/mix-manifest.json index c95c30c..021b82b 100644 --- a/mix-manifest.json +++ b/mix-manifest.json @@ -3,10 +3,8 @@ "/dist/public/fls_login.js": "/dist/public/fls_login.js", "/dist/public/login_helper.js": "/dist/public/login_helper.js", "/dist/public/login_customizer.css": "/dist/public/login_customizer.css", - "/dist/images/index.php": "/dist/images/index.php", "/dist/images/logo.png": "/dist/images/logo.png", "/dist/images/logo.svg": "/dist/images/logo.svg", "/dist/images/success.png": "/dist/images/success.png", - "/dist/libs/diff.js": "/dist/libs/diff.js", - "/dist/libs/index.php": "/dist/libs/index.php" + "/dist/libs/diff.js": "/dist/libs/diff.js" } diff --git a/src/admin/app.scss b/src/admin/app.scss index 086084b..0c5c5f7 100644 --- a/src/admin/app.scss +++ b/src/admin/app.scss @@ -649,7 +649,7 @@ ul.fls_listed_data { p { font-size: 12px; - line-height: 15px; + line-height: 22px; } h3 {