create a repeatable and unique username

This commit is contained in:
lpm0073 2022-10-03 22:55:04 -05:00
parent 6a9fcf65ef
commit bc05c7ea6d

View File

@ -58,9 +58,12 @@ class WPOAuth2(BaseOAuth2):
user_roles = response.get('user_roles', []) user_roles = response.get('user_roles', [])
super_user = 'administrator' in user_roles super_user = 'administrator' in user_roles
# create a unique but repeatable username
username = response.get('user_login') + '_' + response.get('ID')
user_details = { user_details = {
'id': int(response.get('ID')), 'id': int(response.get('ID')),
'username': response.get('user_login'), 'username': username,
'email': response.get('user_email'), 'email': response.get('user_email'),
'first_name': first_name, 'first_name': first_name,
'last_name': last_name, 'last_name': last_name,