Glainez commited on
Commit
befa452
1 Parent(s): 15e12b1

Update AuthVerification.py

Browse files
Files changed (1) hide show
  1. AuthVerification.py +8 -9
AuthVerification.py CHANGED
@@ -1,15 +1,14 @@
1
  import gradio as gr
2
  import os
3
 
4
- def get_accepted_ip_passwords():
5
- ip____passwords_accepted = [os.environ.get(f'USER_{i}', None) for i in range(900) if os.environ.get(f'USER_{i}', False)]
6
- return ip____passwords_accepted
7
 
8
- def auth_verification(password, request: gr.Request):
9
- ip = request.client.host
10
- ip____password = f'{ip}____{password}'
11
- ip____passwords_accepted = get_accepted_ip_passwords()
12
- can_enter_the_space = ip____password in ip____passwords_accepted
13
- return can_enter_the_space
14
 
15
 
 
1
  import gradio as gr
2
  import os
3
 
4
+ def get_accepted_username_passwords():
5
+ username__passwords = [os.environ.get(f'USER_{i}', None) for i in range(900) if os.environ.get(f'USER_{i}', False)]
6
+ return username__passwords
7
 
8
+ def auth_verification(username, password):
9
+ username__password = f'{username}__{password}'
10
+ username__passwords_accepted = get_accepted_username_passwords()
11
+ allowed = username__password in username__passwords_accepted
12
+ return allowed
 
13
 
14