Fixed logout page view

This commit is contained in:
Giuseppe Digilio
2018-05-03 19:53:06 +02:00
parent c8a1fe0860
commit 2c938571b3
5 changed files with 21 additions and 38 deletions

View File

@@ -1,5 +1,9 @@
<div class="text-center mt-5"> <div class="container">
<img class="mb-4" src="assets/images/dspace-logo.png" alt="" width="72" height="72"> <div class="text-center mt-5 row justify-content-md-center">
<h1 class="h3 mb-0 font-weight-normal">{{"logout.form.header" | translate}}</h1> <div class="col-sm-6 col-md-4">
<ds-log-out></ds-log-out> <img class="mb-4 login-logo" src="assets/images/dspace-logo.png">
<h1 class="h3 mb-0 font-weight-normal">{{"logout.form.header" | translate}}</h1>
<ds-log-out></ds-log-out>
</div>
</div>
</div> </div>

View File

@@ -1,15 +1 @@
.login-container { @import '../+login-page/login-page.component.scss';
height: 100%;
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}

View File

@@ -26,6 +26,7 @@ import { NativeWindowRef, NativeWindowService } from '../../shared/services/wind
import { REQUEST } from '@nguniversal/express-engine/tokens'; import { REQUEST } from '@nguniversal/express-engine/tokens';
export const LOGIN_ROUTE = '/login'; export const LOGIN_ROUTE = '/login';
export const LOGOUT_ROUTE = '/logout';
export const REDIRECT_COOKIE = 'dsRedirectUrl'; export const REDIRECT_COOKIE = 'dsRedirectUrl';

View File

@@ -1,5 +1,5 @@
<ul class="navbar-nav" [ngClass]="{'mr-auto': (windowService.isMobileView() | async)}"> <ul class="navbar-nav" [ngClass]="{'mr-auto': (windowService.isMobileView() | async)}">
<li *ngIf="!(isAuthenticated | async) && !(windowService.isMobileView() | async) && showAuth" class="nav-item dropdown" (click)="$event.stopPropagation();"> <li *ngIf="!(isAuthenticated | async) && !(windowService.isMobileView() | async) && (showAuth | async)" class="nav-item dropdown" (click)="$event.stopPropagation();">
<div ngbDropdown placement="bottom-right" class="d-inline-block float-right" @fadeInOut> <div ngbDropdown placement="bottom-right" class="d-inline-block float-right" @fadeInOut>
<a href="#" id="dropdownLogin" class="nav-link" (click)="$event.preventDefault()" ngbDropdownToggle><i class="fa fa-sign-in fa-fw" aria-hidden="true"></i> {{ 'nav.login' | translate }}<span class="caret"></span></a> <a href="#" id="dropdownLogin" class="nav-link" (click)="$event.preventDefault()" ngbDropdownToggle><i class="fa fa-sign-in fa-fw" aria-hidden="true"></i> {{ 'nav.login' | translate }}<span class="caret"></span></a>
<div id="loginDropdownMenu" [ngClass]="{'pl-3 pr-3': (loading | async)}" ngbDropdownMenu aria-labelledby="dropdownLogin"> <div id="loginDropdownMenu" [ngClass]="{'pl-3 pr-3': (loading | async)}" ngbDropdownMenu aria-labelledby="dropdownLogin">
@@ -10,7 +10,7 @@
<li *ngIf="!(isAuthenticated | async) && (windowService.isMobileView() | async)" class="nav-item"> <li *ngIf="!(isAuthenticated | async) && (windowService.isMobileView() | async)" class="nav-item">
<a class="nav-link" routerLink="/login" routerLinkActive="active"><i class="fa fa-sign-in fa-fw" aria-hidden="true"></i> {{ 'nav.login' | translate }}<span class="sr-only">(current)</span></a> <a class="nav-link" routerLink="/login" routerLinkActive="active"><i class="fa fa-sign-in fa-fw" aria-hidden="true"></i> {{ 'nav.login' | translate }}<span class="sr-only">(current)</span></a>
</li> </li>
<li *ngIf="(isAuthenticated | async) && !(windowService.isMobileView() | async)" class="nav-item"> <li *ngIf="(isAuthenticated | async) && !(windowService.isMobileView() | async) && (showAuth | async)" class="nav-item">
<div ngbDropdown placement="bottom-right" class="d-inline-block" [ngClass]="{'float-right': !(windowService.isMobileView() | async)}" @fadeInOut> <div ngbDropdown placement="bottom-right" class="d-inline-block" [ngClass]="{'float-right': !(windowService.isMobileView() | async)}" @fadeInOut>
<a href="#" id="dropdownUser" class="nav-link" (click)="$event.preventDefault()" ngbDropdownToggle><i class="fa fa-user fa-fw" aria-hidden="true"></i>Hello {{(user | async).name}}<span class="caret"></span></a> <a href="#" id="dropdownUser" class="nav-link" (click)="$event.preventDefault()" ngbDropdownToggle><i class="fa fa-user fa-fw" aria-hidden="true"></i>Hello {{(user | async).name}}<span class="caret"></span></a>
<div id="logoutDropdownMenu" ngbDropdownMenu aria-labelledby="dropdownUser"> <div id="logoutDropdownMenu" ngbDropdownMenu aria-labelledby="dropdownUser">

View File

@@ -1,4 +1,4 @@
import { Component, OnDestroy, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable'; import { Observable } from 'rxjs/Observable';
import { RouterReducerState } from '@ngrx/router-store'; import { RouterReducerState } from '@ngrx/router-store';
import { Store } from '@ngrx/store'; import { Store } from '@ngrx/store';
@@ -6,10 +6,10 @@ import { Store } from '@ngrx/store';
import { fadeInOut, fadeOut } from '../animations/fade'; import { fadeInOut, fadeOut } from '../animations/fade';
import { HostWindowService } from '../host-window.service'; import { HostWindowService } from '../host-window.service';
import { AppState, routerStateSelector } from '../../app.reducer'; import { AppState, routerStateSelector } from '../../app.reducer';
import { hasValue, isNotUndefined } from '../empty.util'; import { isNotUndefined } from '../empty.util';
import { getAuthenticatedUser, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors'; import { getAuthenticatedUser, isAuthenticated, isAuthenticationLoading } from '../../core/auth/selectors';
import { Subscription } from 'rxjs/Subscription';
import { Eperson } from '../../core/eperson/models/eperson.model'; import { Eperson } from '../../core/eperson/models/eperson.model';
import { LOGIN_ROUTE, LOGOUT_ROUTE } from '../../core/auth/auth.service';
@Component({ @Component({
selector: 'ds-auth-nav-menu', selector: 'ds-auth-nav-menu',
@@ -17,7 +17,7 @@ import { Eperson } from '../../core/eperson/models/eperson.model';
styleUrls: ['./auth-nav-menu.component.scss'], styleUrls: ['./auth-nav-menu.component.scss'],
animations: [fadeInOut, fadeOut] animations: [fadeInOut, fadeOut]
}) })
export class AuthNavMenuComponent implements OnDestroy, OnInit { export class AuthNavMenuComponent implements OnInit {
/** /**
* Whether user is authenticated. * Whether user is authenticated.
* @type {Observable<string>} * @type {Observable<string>}
@@ -30,12 +30,10 @@ export class AuthNavMenuComponent implements OnDestroy, OnInit {
*/ */
public loading: Observable<boolean>; public loading: Observable<boolean>;
public showAuth = false; public showAuth = Observable.of(false);
public user: Observable<Eperson>; public user: Observable<Eperson>;
protected subs: Subscription[] = [];
constructor(private store: Store<AppState>, constructor(private store: Store<AppState>,
public windowService: HostWindowService) { public windowService: HostWindowService) {
} }
@@ -49,16 +47,10 @@ export class AuthNavMenuComponent implements OnDestroy, OnInit {
this.user = this.store.select(getAuthenticatedUser); this.user = this.store.select(getAuthenticatedUser);
this.subs.push(this.store.select(routerStateSelector) this.showAuth = this.store.select(routerStateSelector)
.filter((router: RouterReducerState) => isNotUndefined(router) && isNotUndefined(router.state)) .filter((router: RouterReducerState) => isNotUndefined(router) && isNotUndefined(router.state))
.subscribe((router: RouterReducerState) => { .map((router: RouterReducerState) => {
this.showAuth = router.state.url !== '/login'; return router.state.url !== LOGIN_ROUTE && router.state.url !== LOGOUT_ROUTE;
})); });
}
ngOnDestroy() {
this.subs
.filter((sub) => hasValue(sub))
.forEach((sub) => sub.unsubscribe());
} }
} }