Skip to content

Commit

Permalink
Cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
flavour committed Apr 2, 2022
1 parent 5918058 commit 58b42ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
eden-dev-77f1cf081 (2022-04-02 10:44:28)
eden-dev-591805873 (2022-04-02 10:50:11)
21 changes: 8 additions & 13 deletions controllers/default.py
Expand Up @@ -1653,25 +1653,20 @@ def _register_validation(form):

form_vars = form.vars

# Mobile Phone
# Mobile/Home Phone Numbers
mobile = form_vars.get("mobile")
if mobile:
import re
from s3 import SINGLE_PHONE_NUMBER_PATTERN
regex = re.compile(SINGLE_PHONE_NUMBER_PATTERN)
if not regex.match(mobile):
form.errors.mobile = T("Invalid phone number")
elif settings.get_auth_registration_mobile_phone_mandatory():
form.errors.mobile = T("Phone number is required")

# Home Phone
home = form_vars.get("home")
if home:
if home or mobile:
import re
from s3 import SINGLE_PHONE_NUMBER_PATTERN
regex = re.compile(SINGLE_PHONE_NUMBER_PATTERN)
if not regex.match(home):
if mobile and not regex.match(mobile):
form.errors.mobile = T("Invalid phone number")
if home and not regex.match(home):
form.errors.home = T("Invalid phone number")

if not mobile and settings.get_auth_registration_mobile_phone_mandatory():
form.errors.mobile = T("Phone number is required")

org = settings.get_auth_registration_organisation_default()
if org:
Expand Down

0 comments on commit 58b42ad

Please sign in to comment.