feat: auto log in feature
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
d8d0504570
commit
e347b1eed1
@ -8,3 +8,4 @@ KEYCLOAK_REALM=lumbung-space
|
|||||||
REDIS_DB=0
|
REDIS_DB=0
|
||||||
REDIS_HOST=localhost
|
REDIS_HOST=localhost
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
|
AUTOMATICALLY_LOG_IN=False
|
||||||
|
@ -38,3 +38,6 @@ elif LOG_LEVEL == "debug":
|
|||||||
APP_LOG_LEVEL = logging.DEBUG
|
APP_LOG_LEVEL = logging.DEBUG
|
||||||
else:
|
else:
|
||||||
APP_LOG_LEVEL = logging.INFO
|
APP_LOG_LEVEL = logging.INFO
|
||||||
|
|
||||||
|
# Automatically log folks in or show the default log in page?
|
||||||
|
AUTOMATICALLY_LOG_IN = environ.get("AUTOMATICALLY_LOG_IN", False)
|
||||||
|
@ -11,6 +11,11 @@ router = APIRouter()
|
|||||||
|
|
||||||
@router.get("/login")
|
@router.get("/login")
|
||||||
async def login(request: Request):
|
async def login(request: Request):
|
||||||
|
from keycloak_collective_portal.config import AUTOMATICALLY_LOG_IN
|
||||||
|
|
||||||
|
if AUTOMATICALLY_LOG_IN:
|
||||||
|
return RedirectResponse(request.url_for("login_keycloak"))
|
||||||
|
|
||||||
return request.app.state.templates.TemplateResponse(
|
return request.app.state.templates.TemplateResponse(
|
||||||
"login.html", context={"request": request}
|
"login.html", context={"request": request}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user