fix - fix redirecting after logging in

This commit is contained in:
Ishaan Jaff 2024-06-05 15:37:45 -07:00
parent 078d3cd5ad
commit 06af142107

View file

@ -2709,13 +2709,15 @@ def decrypt_value(value: bytes, master_key: str) -> str:
# LiteLLM Admin UI - Non SSO Login # LiteLLM Admin UI - Non SSO Login
html_form = """ url_to_redirect_to = os.getenv("PROXY_BASE_URL", "")
url_to_redirect_to += "/login"
html_form = f"""
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>LiteLLM Login</title> <title>LiteLLM Login</title>
<style> <style>
body { body {{
font-family: Arial, sans-serif; font-family: Arial, sans-serif;
background-color: #f4f4f4; background-color: #f4f4f4;
margin: 0; margin: 0;
@ -2724,42 +2726,42 @@ html_form = """
justify-content: center; justify-content: center;
align-items: center; align-items: center;
height: 100vh; height: 100vh;
} }}
form { form {{
background-color: #fff; background-color: #fff;
padding: 20px; padding: 20px;
border-radius: 8px; border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
} }}
label { label {{
display: block; display: block;
margin-bottom: 8px; margin-bottom: 8px;
} }}
input { input {{
width: 100%; width: 100%;
padding: 8px; padding: 8px;
margin-bottom: 16px; margin-bottom: 16px;
box-sizing: border-box; box-sizing: border-box;
border: 1px solid #ccc; border: 1px solid #ccc;
border-radius: 4px; border-radius: 4px;
} }}
input[type="submit"] { input[type="submit"] {{
background-color: #4caf50; background-color: #4caf50;
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
} }}
input[type="submit"]:hover { input[type="submit"]:hover {{
background-color: #45a049; background-color: #45a049;
} }}
</style> </style>
</head> </head>
<body> <body>
<form action="/login" method="post"> <form action="{url_to_redirect_to}" method="post">
<h2>LiteLLM Login</h2> <h2>LiteLLM Login</h2>
<p>By default Username is "admin" and Password is your set LiteLLM Proxy `MASTER_KEY`</p> <p>By default Username is "admin" and Password is your set LiteLLM Proxy `MASTER_KEY`</p>
@ -2771,8 +2773,6 @@ html_form = """
<input type="password" id="password" name="password" required> <input type="password" id="password" name="password" required>
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</form> </form>
</body>
</html>
""" """