Commit 25b10a22 authored by Nicolas Pernoud's avatar Nicolas Pernoud
Browse files

fix: behavior when accessing directly login route while already logged

parent cdd2be4d
Pipeline #6792 passed with stages
in 2 minutes and 51 seconds
......@@ -11,52 +11,58 @@ let password_field;
let login_inmemory;
let login_icon;
export function mount(where) {
Navbar.CreateMenu();
export async function mount(where) {
mountpoint = where;
document.getElementById(mountpoint).innerHTML = /* HTML */ `
<div class="columns">
<div class="column is-half is-offset-one-quarter">
<div class="card">
<div class="card-content">
<div class="field">
<p class="control has-icons-left has-icons-right">
<input id="login-login" class="input" type="text" placeholder="Login" />
<span class="icon is-small is-left">
<i class="fas fa-user"></i>
</span>
</p>
</div>
<div class="field">
<p class="control has-icons-left">
<input id="login-password" class="input" type="password" placeholder="Password" />
<span class="icon is-small is-left">
<i class="fas fa-lock"></i>
</span>
</p>
let user = await Auth.GetUser();
if (user !== undefined) {
document.getElementById(mountpoint).innerHTML = "";
location.hash = "#";
} else {
Navbar.CreateMenu();
document.getElementById(mountpoint).innerHTML = /* HTML */ `
<div class="columns">
<div class="column is-half is-offset-one-quarter">
<div class="card">
<div class="card-content">
<div class="field">
<p class="control has-icons-left has-icons-right">
<input id="login-login" class="input" type="text" placeholder="Login" />
<span class="icon is-small is-left">
<i class="fas fa-user"></i>
</span>
</p>
</div>
<div class="field">
<p class="control has-icons-left">
<input id="login-password" class="input" type="password" placeholder="Password" />
<span class="icon is-small is-left">
<i class="fas fa-lock"></i>
</span>
</p>
</div>
</div>
<footer class="card-footer">
${loginModes.inmemory
? /* HTML */ `
<a id="login-inmemory" class="card-footer-item">
<span class="icon" id="login-icon"><i class="fas fa-key"></i></span>Login
</a>
`
: ""}
${loginModes.oauth2
? /* HTML */ `
<a id="login-oauth2" class="card-footer-item" href="/OAuth2Login">
<span class="icon"><i class="fab fa-keycdn"></i></span>Login with OAuth2
</a>
`
: ""}
</footer>
</div>
<footer class="card-footer">
${loginModes.inmemory
? /* HTML */ `
<a id="login-inmemory" class="card-footer-item">
<span class="icon" id="login-icon"><i class="fas fa-key"></i></span>Login
</a>
`
: ""}
${loginModes.oauth2
? /* HTML */ `
<a id="login-oauth2" class="card-footer-item" href="/OAuth2Login">
<span class="icon"><i class="fab fa-keycdn"></i></span>Login with OAuth2
</a>
`
: ""}
</footer>
</div>
</div>
</div>
`;
registerModalFields();
`;
registerModalFields();
}
}
function registerModalFields() {
......
......@@ -32,7 +32,7 @@
<div class="navbar-brand">
<div class="navbar-item">
<a class="button is-primary is-rounded is-outlined" href="https://www.github.com/nicolaspernoud/Vestibule" target="_blank" rel="noopener noreferrer">
<span>4.3.41</span>
<span>4.3.42</span>
<span class="icon">
<svg
class="svg-inline--fa fa-github fa-w-16"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment