dwipper commited on
Commit
d66b2f9
·
1 Parent(s): bf35c0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -51,10 +51,12 @@ def log_login(username):
51
  def login_auth(username, password):
52
 
53
  airtable_endpoint = f'https://api.airtable.com/v0/{base_id}/{users_table_name}'
 
 
54
 
55
  # Query the 'users' table to check for a match with the provided username and password
56
  params = {
57
- 'filterByFormula': f'AND(user_name = "{username}", password = "{password}")'
58
  }
59
 
60
  response = requests.get(airtable_endpoint, headers=headers, params=params)
@@ -67,14 +69,14 @@ def login_auth(username, password):
67
  user_details = data['records'][0]['fields']
68
 
69
  #Log that the user logged in
70
- log_login(username)
71
 
72
  #Set the global logged_in_user variable. This used in the append_to_at_qalog function to track what user asked the question
73
  global logged_in_user,user_user_role, user_output_format, user_school
74
  user_user_role = user_details.get('user_role')
75
  user_output_format = user_details.get('output_format')
76
  user_school = user_details.get('school_name', [None])[0]
77
- logged_in_user = username
78
 
79
  print(user_school)
80
  print(user_output_format)
 
51
  def login_auth(username, password):
52
 
53
  airtable_endpoint = f'https://api.airtable.com/v0/{base_id}/{users_table_name}'
54
+
55
+ username_lcase = username.lower()
56
 
57
  # Query the 'users' table to check for a match with the provided username and password
58
  params = {
59
+ 'filterByFormula': f'AND(user_name = "{username_lcase}", password = "{password}")'
60
  }
61
 
62
  response = requests.get(airtable_endpoint, headers=headers, params=params)
 
69
  user_details = data['records'][0]['fields']
70
 
71
  #Log that the user logged in
72
+ log_login(username_lcase)
73
 
74
  #Set the global logged_in_user variable. This used in the append_to_at_qalog function to track what user asked the question
75
  global logged_in_user,user_user_role, user_output_format, user_school
76
  user_user_role = user_details.get('user_role')
77
  user_output_format = user_details.get('output_format')
78
  user_school = user_details.get('school_name', [None])[0]
79
+ logged_in_user = username_lcase
80
 
81
  print(user_school)
82
  print(user_output_format)