Skip to content
Snippets Groups Projects
Commit a090cb6b authored by Reiter, Christoph's avatar Reiter, Christoph :snake:
Browse files

LoginButton: Don't show a logged-in/logged-out status during login

In case the login process takes some time we would show a "login"
button which makes the user try to click it. There is a good chance
that aroudn that time we get logged in, so the click will log the user
out.

Avoid that by not showing anything during logging in.
parent fd5bb1c2
No related branches found
No related tags found
No related merge requests found
Pipeline #14932 passed
...@@ -52,6 +52,17 @@ let loginSVG = ` ...@@ -52,6 +52,17 @@ let loginSVG = `
</svg> </svg>
`; `;
let loggingInSVG = `
<svg
viewBox="0 0 100 100"
y="0px"
x="0px"
id="icon"
role="img"
version="1.1">
</svg>
`;
export class LoginButton extends ScopedElementsMixin(LitElement) { export class LoginButton extends ScopedElementsMixin(LitElement) {
constructor() { constructor() {
...@@ -77,6 +88,7 @@ export class LoginButton extends ScopedElementsMixin(LitElement) { ...@@ -77,6 +88,7 @@ export class LoginButton extends ScopedElementsMixin(LitElement) {
this._bus = new EventBus(); this._bus = new EventBus();
this._bus.subscribe('auth-update', (data) => { this._bus.subscribe('auth-update', (data) => {
console.log(data);
this._loginData = data; this._loginData = data;
}); });
} }
...@@ -153,7 +165,17 @@ export class LoginButton extends ScopedElementsMixin(LitElement) { ...@@ -153,7 +165,17 @@ export class LoginButton extends ScopedElementsMixin(LitElement) {
} }
render() { render() {
if (this._loginData.status === LoginStatus.LOGGED_IN) { if (this._loginData.status === LoginStatus.LOGGING_IN) {
// try to keep the layout the same to avoid layout shifts
return html`
<a href="#">
<div class="login-box login-button">
<div class="icon">${unsafeHTML(loggingInSVG)}</div>
<div class="label">&#8203;</div>
</div>
</a>
`;
} else if (this._loginData.status === LoginStatus.LOGGED_IN) {
return html` return html`
<a href="#" @click="${this._onLogoutClicked}"> <a href="#" @click="${this._onLogoutClicked}">
<div class="login-box login-button"> <div class="login-box login-button">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment