Skip to content
Snippets Groups Projects
  • Reiter, Christoph's avatar
    f7bf48d3
    Replace the remember-login attribute with a new try-login one · f7bf48d3
    Reiter, Christoph authored
    With the new ability to log in without redirecting to keycloak and reloading the page
    we can now try to login on start every time.
    
    Instead of remembering the login state in the session storage we just ask keycloak in an iframe
    on start. To better describe this new behaviour rename the attribute from remember-login to try-login.
    f7bf48d3
    History
    Replace the remember-login attribute with a new try-login one
    Reiter, Christoph authored
    With the new ability to log in without redirecting to keycloak and reloading the page
    we can now try to login on start every time.
    
    Instead of remembering the login state in the session storage we just ask keycloak in an iframe
    on start. To better describe this new behaviour rename the attribute from remember-login to try-login.
vpu-auth-demo.js 1.80 KiB
import {i18n} from './i18n.js';
import {html, LitElement} from 'lit-element';
import './vpu-auth';
import * as commonUtils from 'vpu-common/utils';

class AuthDemo extends LitElement {
    constructor() {
        super();
        this.lang = 'de';
    }

    static get properties() {
        return {
            lang: { type: String },
        };
    }

    update(changedProperties) {
        changedProperties.forEach((oldValue, propName) => {
            if (propName === "lang") {
                i18n.changeLanguage(this.lang);
            }
        });

        super.update(changedProperties);
    }

    render() {
        commonUtils.initAssetBaseURL('vpu-auth-src');
        const silentCheckSsoUri = commonUtils.getAssetURL('silent-check-sso.html');
        return html`
            <style>
               /* from BULMA.CSS */
                .section {
                   padding: 3rem 1.5rem;
                   font-family: sans-serif;
                }
                .content h1 {
                    font-size: 2em;
                    margin-bottom: .5em;
                }
                .content h1, .content h2, .content h3, .content h4, .content h5, .content h6 {
                    color: #363636;
                    font-weight: 600;
                    line-height: 1.125;
                }
            </style>
            <section class="section">
                <div class="container">
                    <h1 class="title">Auth-Demo</h1>
                </div>
                <div class="container">
                    <vpu-auth lang="${this.lang}" client-id="${commonUtils.setting('keyCloakClientId')}" silent-check-sso-uri="${silentCheckSsoUri}" load-person try-login></vpu-auth>
                </div>
            </section>
        `;
    }
}

commonUtils.defineCustomElement('vpu-auth-demo', AuthDemo);