new parameter to auto create or not users with alternate login methods
This commit is contained in:
@@ -1792,6 +1792,7 @@ class Auth(AuthAPI):
|
||||
servicevalidate='serviceValidate',
|
||||
proxyvalidate='proxyValidate',
|
||||
logout='logout'),
|
||||
cas_create_user=True,
|
||||
extra_fields={},
|
||||
actions_disabled=[],
|
||||
controller=controller,
|
||||
@@ -2284,6 +2285,7 @@ class Auth(AuthAPI):
|
||||
If the user doesn't yet exist, then they are created.
|
||||
"""
|
||||
table_user = self.table_user()
|
||||
create_user = self.settings.cas_create_user
|
||||
user = None
|
||||
checks = []
|
||||
# make a guess about who this user is
|
||||
@@ -2316,6 +2318,11 @@ class Auth(AuthAPI):
|
||||
update_keys[key] = keys[key]
|
||||
user.update_record(**update_keys)
|
||||
elif checks:
|
||||
if create_user is False:
|
||||
# Remove current open session a send message
|
||||
self.logout(next=None, onlogout=None, log=None)
|
||||
raise HTTP(403, "Forbidden. User need to be created first.")
|
||||
|
||||
if 'first_name' not in keys and 'first_name' in table_user.fields:
|
||||
guess = keys.get('email', 'anonymous').split('@')[0]
|
||||
keys['first_name'] = keys.get('username', guess)
|
||||
|
||||
Reference in New Issue
Block a user