summaryrefslogtreecommitdiffstats
path: root/parsers/users.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/users.py')
-rw-r--r--parsers/users.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/parsers/users.py b/parsers/users.py
index fe11bdf..cf721ba 100644
--- a/parsers/users.py
+++ b/parsers/users.py
@@ -25,20 +25,25 @@ todo = """
USERS_FILE = "users.json"
ENCRYPTED_DIR = "encrypted"
-def register_user(u, email, password=None, pwhash=None):
+def register_user(u, email, password=None, pwhash=None, fullname=None):
+ """Create User and we may not have a Person to tie it to if it is a future caver.
+ Do not use the lastname field, put the whole free text identification into firstname
+ as this saves hassle and works with Wookey too
+ """
try:
if existing_user := User.objects.filter(username=u): # WALRUS
print(f" - deleting existing user '{existing_user[0]}' before importing")
existing_user[0].delete()
- user = User.objects.create_user(u, email)
+ user = User.objects.create_user(u, email, first_name=fullname)
if pwhash:
user.password = pwhash
elif password:
user.set_password(password) # function creates hash and stores hash
print(f" # hashing provided clear-text password {password} to make pwhash for user {u}")
else:
- user.set_password('secret') # function creates hash and stores hash
- print(f" # hashing 'secret' password to make pwhash for user {u}")
+ # user.set_password(None) # use Django special setting for invalid password, but then FAILS to send password reset email
+ user.set_password("secret") # Why is the Django logic broken. Hmph.
+ print(f" # setting INVALID password for user {u}, must be reset by password_reset")
user.is_staff = False
user.is_superuser = False
user.save()