Login / Logout
This commit is contained in:
@@ -15,8 +15,6 @@ export class KeycloakService {
|
|||||||
async init(): Promise<void> {
|
async init(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const authenticated = await this.keycloak.init({
|
const authenticated = await this.keycloak.init({
|
||||||
onLoad: 'check-sso',
|
|
||||||
silentCheckSsoRedirectUri: `${window.location.origin}/assets/silent-check-sso.html`,
|
|
||||||
pkceMethod: 'S256',
|
pkceMethod: 'S256',
|
||||||
});
|
});
|
||||||
this.isAuthenticated.set(authenticated);
|
this.isAuthenticated.set(authenticated);
|
||||||
|
|||||||
+23
-6
@@ -34,6 +34,11 @@
|
|||||||
letter-spacing: -0.02em;
|
letter-spacing: -0.02em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-version {
|
||||||
|
font-size: 0.72rem;
|
||||||
|
color: #9ca3af;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar-nav {
|
.sidebar-nav {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -64,6 +69,24 @@
|
|||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sidebar-login {
|
||||||
|
margin-top: auto;
|
||||||
|
width: 100%;
|
||||||
|
padding: 0.5rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #ffffff;
|
||||||
|
background: #2563eb;
|
||||||
|
border: none;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: background 0.1s;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sidebar-login:hover {
|
||||||
|
background: #1d4ed8;
|
||||||
|
}
|
||||||
|
|
||||||
.sidebar-user {
|
.sidebar-user {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -101,9 +124,3 @@
|
|||||||
border-color: #fca5a5;
|
border-color: #fca5a5;
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebar-footer {
|
|
||||||
padding: 0 0.5rem;
|
|
||||||
font-size: 0.72rem;
|
|
||||||
color: #9ca3af;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -25,8 +25,10 @@
|
|||||||
<circle cx="18" cy="16" r="6" fill="#48BB78"/>
|
<circle cx="18" cy="16" r="6" fill="#48BB78"/>
|
||||||
</svg>
|
</svg>
|
||||||
<span class="sidebar-logo-text">Bonsai</span>
|
<span class="sidebar-logo-text">Bonsai</span>
|
||||||
|
<span class="sidebar-version">v{{ version }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@if (keycloak.isAuthenticated()) {
|
||||||
<nav class="sidebar-nav">
|
<nav class="sidebar-nav">
|
||||||
@for (item of menuItems; track item.path) {
|
@for (item of menuItems; track item.path) {
|
||||||
<a
|
<a
|
||||||
@@ -40,12 +42,11 @@
|
|||||||
}
|
}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@if (keycloak.isAuthenticated()) {
|
|
||||||
<div class="sidebar-user">
|
<div class="sidebar-user">
|
||||||
<span class="sidebar-user-name">{{ keycloak.username() }}</span>
|
<span class="sidebar-user-name">{{ keycloak.username() }}</span>
|
||||||
<button class="sidebar-logout" (click)="logout()">Déconnexion</button>
|
<button class="sidebar-logout" (click)="logout()">Déconnexion</button>
|
||||||
</div>
|
</div>
|
||||||
|
} @else {
|
||||||
|
<button class="sidebar-login" (click)="keycloak.login()">Connexion</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
<footer class="sidebar-footer">v{{ version }}</footer>
|
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
Reference in New Issue
Block a user