Added shibboleth button to log-in.component

This commit is contained in:
Julius Gruber
2019-06-03 10:30:01 +02:00
parent d6eab441a4
commit b4f3bf71ad
2 changed files with 23 additions and 1 deletions

View File

@@ -20,6 +20,10 @@
<div *ngIf="(error | async) && hasError" class="alert alert-danger" role="alert" @fadeOut>{{ (error | async) | translate }}</div>
<div *ngIf="(message | async) && hasMessage" class="alert alert-info" role="alert" @fadeOut>{{ (message | async) | translate }}</div>
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit" [disabled]="!form.valid">{{"login.form.submit" | translate}}</button>
<div *ngIf="(hasSsoLoginUrl | async)">
<div class="text-center mt-2"><span class="align-middle">{{"login.form.or-divider" | translate}}</span></div>
<a class="btn btn-lg btn-primary btn-block mt-2" [href]="(ssoLoginUrl | async)" role="button">{{"login.form.ssoLogin" | translate}}</a>
</div>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">{{"login.form.new-user" | translate}}</a>
<a class="dropdown-item" href="#">{{"login.form.forgot-password" | translate}}</a>

View File

@@ -11,7 +11,7 @@ import {
import {
getAuthenticationError,
getAuthenticationInfo,
getAuthenticationInfo, getSSOLoginUrl,
isAuthenticated,
isAuthenticationLoading,
} from '../../core/auth/selectors';
@@ -81,6 +81,18 @@ export class LogInComponent implements OnDestroy, OnInit {
*/
private alive = true;
/**
* The redirect url to login with sso.
* @type {Observable<string>}
*/
public ssoLoginUrl: Observable<string>;
/**
* True if is present the url to login with sso.
* @type {Observable<boolean>}
*/
public hasSsoLoginUrl: Observable<boolean>;
/**
* @constructor
* @param {AuthService} authService
@@ -129,6 +141,9 @@ export class LogInComponent implements OnDestroy, OnInit {
// set loading
this.loading = this.store.pipe(select(isAuthenticationLoading));
// set sso login url
this.ssoLoginUrl = this.store.pipe(select(getSSOLoginUrl));
// subscribe to success
this.store.pipe(
select(isAuthenticated),
@@ -138,6 +153,9 @@ export class LogInComponent implements OnDestroy, OnInit {
this.authService.redirectToPreviousUrl();
}
);
this.hasSsoLoginUrl = this.ssoLoginUrl
.pipe(map((url) => isNotEmpty(url)))
}
/**