From 9def5d689e5c797e213619c9ec4f78d04c3575b9 Mon Sep 17 00:00:00 2001 From: Luca Date: Sun, 10 Apr 2022 18:23:39 +0200 Subject: [PATCH] Also check if required fields are empty --- includes/pages/guest_login.php | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/includes/pages/guest_login.php b/includes/pages/guest_login.php index a663e3b3..e22feb8c 100644 --- a/includes/pages/guest_login.php +++ b/includes/pages/guest_login.php @@ -92,30 +92,22 @@ function guest_register() if ($request->hasPostData('submit')) { $valid = true; - if ($request->has('prename')) { - $preName = strip_request_item('prename'); - } else { + if (!$request->has('prename') || empty($preName = strip_request_item('prename'))) { $valid = false; $msg .= error(__('Please enter your first name.'), true); } - if ($request->has('lastname')) { - $lastName = strip_request_item('lastname'); - } else { + if (!$request->has('lastname') || empty($lastName = strip_request_item('lastname'))) { $valid = false; $msg .= error(__('Please enter your last name.'), true); } - if ($request->has('mobile')) { - $mobile = strip_request_item('mobile'); - - if (User::whereName($mobile)->count() > 0) { - $valid = false; - $msg .= error(__('This mobile number is already in use.'), true); - } - } else { + if (!$request->has('mobile') || empty($mobile = strip_request_item('mobile'))) { $valid = false; $msg .= error(__('Please enter your mobile number.'), true); + } else if (User::whereName($mobile)->count() > 0) { + $valid = false; + $msg .= error(__('This mobile number is already in use.'), true); } if ($request->has('mobile_consent')) { @@ -314,6 +306,10 @@ function guest_register() $lastName = $form_data['last_name']; } + if (!$mobile && !empty($form_data['phone_number'])) { + $mobile = $form_data['phone_number']; + } + return page_with_title(register_title(), [ form_element('', __('By completing this form you\'re registering as a Chaos-Angel. This script will create you an account in the angel task scheduler.')), form_element('', entry_required() . ' = ' . __('Entry required!')),