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',
|
servicevalidate='serviceValidate',
|
||||||
proxyvalidate='proxyValidate',
|
proxyvalidate='proxyValidate',
|
||||||
logout='logout'),
|
logout='logout'),
|
||||||
|
cas_create_user=True,
|
||||||
extra_fields={},
|
extra_fields={},
|
||||||
actions_disabled=[],
|
actions_disabled=[],
|
||||||
controller=controller,
|
controller=controller,
|
||||||
@@ -2284,6 +2285,7 @@ class Auth(AuthAPI):
|
|||||||
If the user doesn't yet exist, then they are created.
|
If the user doesn't yet exist, then they are created.
|
||||||
"""
|
"""
|
||||||
table_user = self.table_user()
|
table_user = self.table_user()
|
||||||
|
create_user = self.settings.cas_create_user
|
||||||
user = None
|
user = None
|
||||||
checks = []
|
checks = []
|
||||||
# make a guess about who this user is
|
# make a guess about who this user is
|
||||||
@@ -2316,6 +2318,11 @@ class Auth(AuthAPI):
|
|||||||
update_keys[key] = keys[key]
|
update_keys[key] = keys[key]
|
||||||
user.update_record(**update_keys)
|
user.update_record(**update_keys)
|
||||||
elif checks:
|
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:
|
if 'first_name' not in keys and 'first_name' in table_user.fields:
|
||||||
guess = keys.get('email', 'anonymous').split('@')[0]
|
guess = keys.get('email', 'anonymous').split('@')[0]
|
||||||
keys['first_name'] = keys.get('username', guess)
|
keys['first_name'] = keys.get('username', guess)
|
||||||
|
|||||||
Reference in New Issue
Block a user