diff --git a/src/account/actions.py b/src/account/actions.py index eb0dda47f2535876d24adfb7e81c7d74fe32c1f0..c4a73826b0d8082f291b3ba98180bdb808026320 100644 --- a/src/account/actions.py +++ b/src/account/actions.py @@ -5,6 +5,7 @@ from django.conf import settings from django.core.exceptions import ImproperlyConfigured import ldap +import re import memberdb.models from datetime import date from squarepay import dispense @@ -100,10 +101,25 @@ def unlock_account(username): reason = "account unlocked by uccportal on %s" % str(today) dispense.set_dispense_flag(username, '!disabled', reason) - +# Account creation steps: +# def create_account(member): + username = + log.info("I: creating new account for %s (%s %s)") + + # prepend student numbers with 'sn' + if re.fullmatch(r"^2\d{7}$", username): + log.info("I: username is a student number, adding sn prefix") + username = sn + username + + # usernames can't begin with a numeric + if re.match(r"^\d", username): + log.error("E: The username %s cannot start with a digit." % username) + return; + + return None; diff --git a/src/gms/settings.py b/src/gms/settings.py index 63a7f9dcbec63b0abf9a4cf65990c6b8e6988468..935e805fec6072609bd420d1cec5e7b11e90bb76 100644 --- a/src/gms/settings.py +++ b/src/gms/settings.py @@ -11,6 +11,9 @@ https://docs.djangoproject.com/en/2.1/ref/settings/ # import local settings from gms.settings_local import * +# DEBUG ALLOW +ALLOWED_HOSTS = ['127.0.0.1', 'localhost', "130.95.13.36"] + # Application definition INSTALLED_APPS = ( diff --git a/src/memberdb/models.py b/src/memberdb/models.py index cfb8f33d508a147d1aa2dc4c7a9d6346879e4dd1..d5ba6f1484a5fffca285336dcb8a6d7155843b86 100644 --- a/src/memberdb/models.py +++ b/src/memberdb/models.py @@ -110,6 +110,11 @@ PAYMENT_METHODS = [ ('', 'No payment') ] +ACCOUNT_STATUS = [ + 'enabled', + 'disabled', + 'no account' + ] @@ -157,8 +162,6 @@ class Member (IncAssocMember): # account info def get_account_status(self): - - return; def __str__ (self):