Commit daea4138 authored by Daniel W Bond's avatar Daniel W Bond
Browse files

create new users on the database when first logged in

parent 0672d3c5
from django.contrib.auth.models import User
from django.conf import settings
def create_user(tree):
username = tree[0][0].text
user, user_created = User.objects.get_or_create(username=username)
if user_created:
user.email = "%s@%s" % (username, settings.ORGANIZATION_EMAIL_DOMAIN)
user.save()
print("Created user %s!" % username)
......@@ -139,3 +139,7 @@ AUTHENTICATION_BACKENDS = (
CAS_SERVER_URL = 'https://login.gmu.edu'
CAS_LOGOUT_COMPLETELY = True
CAS_PROVIDE_URL_TO_LOGOUT = True
CAS_RESPONSE_CALLBACKS = (
'accounts.cas_callbacks.create_user',
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment