Code clean up. Simplifying person, user, contact, and address methods
This commit is contained in:
@@ -223,11 +223,12 @@ async def user_authenticate(
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if account_id and username and password:
|
||||
account_id = commons.x_account_id
|
||||
account_id = commons.x_account_id
|
||||
|
||||
if username and password:
|
||||
user_data = {}
|
||||
user_data['account_id'] = account_id
|
||||
if not null_account_id: user_data['account_id'] = account_id
|
||||
else: user_data['account_id'] = None
|
||||
user_data['username'] = username
|
||||
|
||||
# sql_select(table_name='user', data=user_data)
|
||||
@@ -631,14 +632,14 @@ async def lookup_email(
|
||||
data['account_id'] = account_id
|
||||
data['email'] = email
|
||||
|
||||
if enabled in ['enabled', 'disabled', 'all']:
|
||||
if enabled == 'enabled':
|
||||
if commons.enabled in ['enabled', 'disabled', 'all']:
|
||||
if commons.enabled == 'enabled':
|
||||
data['enable'] = True
|
||||
sql_enabled = f'AND `user`.enable = :enable'
|
||||
elif enabled == 'disabled':
|
||||
elif commons.enabled == 'disabled':
|
||||
data['enable'] = False
|
||||
sql_enabled = f'AND `user`.enable = :enable'
|
||||
elif enabled == 'all':
|
||||
elif commons.enabled == 'all':
|
||||
sql_enabled = ''
|
||||
else:
|
||||
return mk_resp(data=None, status_code=400, response=commons.response) # Bad Request
|
||||
|
||||
Reference in New Issue
Block a user