Kamonphanpro commited on
Commit
43de31b
·
1 Parent(s): 4a63e8c

fix: cast string password

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -29,7 +29,7 @@ def list_usernames():
29
  if is_data_exist():
30
  if isinstance(sheets, dict) and "employee_authentication" in sheets:
31
  data = sheets["employee_authentication"]
32
- usernames = data["ชื่อ-สกุลพนักงาน"].unique()
33
  # Display usernames in an HTML table for easy copying
34
  html_content = "<h4>Available Usernames:</h4><ul>"
35
  for username in usernames:
@@ -52,7 +52,7 @@ def authenticate(input_username, input_password):
52
  true_password = auth_data.loc[
53
  auth_data["ชื่อ-สกุลพนักงาน"] == input_username, "password"
54
  ].values[0]
55
- return true_password == input_password # Simplified for this example
56
 
57
 
58
  def show_employee_data(username, password):
@@ -65,7 +65,7 @@ def show_employee_data(username, password):
65
  if not employee_data.empty:
66
  return employee_data
67
  else:
68
- raise gr.Error("No data available for this user.")
69
  else:
70
  raise gr.Error("No data uploaded by admin.")
71
  else:
 
29
  if is_data_exist():
30
  if isinstance(sheets, dict) and "employee_authentication" in sheets:
31
  data = sheets["employee_authentication"]
32
+ usernames = data[["ชื่อ-สกุลพนักงาน", 'password']].to_list()
33
  # Display usernames in an HTML table for easy copying
34
  html_content = "<h4>Available Usernames:</h4><ul>"
35
  for username in usernames:
 
52
  true_password = auth_data.loc[
53
  auth_data["ชื่อ-สกุลพนักงาน"] == input_username, "password"
54
  ].values[0]
55
+ return str(true_password) == str(input_password) # Simplified for this example
56
 
57
 
58
  def show_employee_data(username, password):
 
65
  if not employee_data.empty:
66
  return employee_data
67
  else:
68
+ raise gr.Error("No data found for this user.")
69
  else:
70
  raise gr.Error("No data uploaded by admin.")
71
  else: