mgbam commited on
Commit
1310b61
·
verified ·
1 Parent(s): e777c17

Update services/auth.py

Browse files
Files changed (1) hide show
  1. services/auth.py +7 -3
services/auth.py CHANGED
@@ -4,7 +4,7 @@ from config.settings import settings
4
  from repositories.user_repo import UserRepo
5
  from models.db import init_db
6
 
7
- # Create tables if they don't exist
8
  init_db()
9
 
10
  user_repo = UserRepo(settings.database_url)
@@ -26,8 +26,12 @@ def init_auth():
26
  authenticator = init_auth()
27
 
28
  def require_login():
29
- # Only specify location now
30
- name, authentication_status, username = authenticator.login(location="sidebar")
 
 
 
 
31
  if not authentication_status:
32
  st.stop()
33
  return username
 
4
  from repositories.user_repo import UserRepo
5
  from models.db import init_db
6
 
7
+ # Initialize DB tables
8
  init_db()
9
 
10
  user_repo = UserRepo(settings.database_url)
 
26
  authenticator = init_auth()
27
 
28
  def require_login():
29
+ login_result = authenticator.login(location="sidebar")
30
+ # Bail out if login form didn't render a result
31
+ if login_result is None:
32
+ st.stop()
33
+
34
+ name, authentication_status, username = login_result
35
  if not authentication_status:
36
  st.stop()
37
  return username