Spaces:
Runtime error
Runtime error
IsaacKerson
commited on
Commit
•
7cbab12
1
Parent(s):
b76b7ad
add self.check_username to auth
Browse files- authenticator.py +13 -12
authenticator.py
CHANGED
@@ -203,18 +203,19 @@ class Authenticate:
|
|
203 |
self.password = login_form.text_input('Password', type='password')
|
204 |
|
205 |
if login_form.form_submit_button('Login'):
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
|
|
218 |
else:
|
219 |
st.session_state['authentication_status'] = False
|
220 |
|
203 |
self.password = login_form.text_input('Password', type='password')
|
204 |
|
205 |
if login_form.form_submit_button('Login'):
|
206 |
+
if self.check_username() is not None:
|
207 |
+
try:
|
208 |
+
if self.check_pw():
|
209 |
+
st.session_state['name'] = self.dbname
|
210 |
+
self.exp_date = self.exp_date()
|
211 |
+
self.token = self.token_encode()
|
212 |
+
self.cookie_manager.set(self.cookie_name, self.token,
|
213 |
+
expires_at=datetime.now() + timedelta(days=self.cookie_expiry_days))
|
214 |
+
st.session_state['authentication_status'] = True
|
215 |
+
else:
|
216 |
+
st.session_state['authentication_status'] = False
|
217 |
+
except Exception as e:
|
218 |
+
print(e)
|
219 |
else:
|
220 |
st.session_state['authentication_status'] = False
|
221 |
|