fix landing page
This commit is contained in:
@@ -37,11 +37,30 @@
|
||||
|
||||
<script src="/js/api.js"></script>
|
||||
<script>
|
||||
// Redirect if already logged in
|
||||
if (api.isAuthenticated()) {
|
||||
window.location.href = '/presence';
|
||||
async function init() {
|
||||
// Redirect if already logged in
|
||||
if (api.isAuthenticated()) {
|
||||
window.location.href = '/presence';
|
||||
return;
|
||||
}
|
||||
|
||||
// Check auth mode - if Authelia enabled, redirect to Authelia login
|
||||
try {
|
||||
const configResponse = await fetch('/api/auth/config');
|
||||
const config = await configResponse.json();
|
||||
|
||||
if (config.authelia_enabled && config.login_url) {
|
||||
const returnUrl = encodeURIComponent(window.location.origin + '/presence');
|
||||
window.location.href = `${config.login_url}?rd=${returnUrl}`;
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
// Continue with local login
|
||||
}
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
document.getElementById('loginForm').addEventListener('submit', async (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user