Test if reopening PR works

This commit is contained in:
Julius Gruber
2019-09-04 14:14:12 +02:00
parent 093ad47a3d
commit c428b1deef
10 changed files with 120 additions and 38 deletions

View File

@@ -1,4 +1,3 @@
<ds-loading *ngIf="(loading | async) || (isAuthenticated | async)" class="m-5"></ds-loading>
<form *ngIf="!(loading | async) && !(isAuthenticated | async)" class="form-login px-4 py-3" (ngSubmit)="submit()"
[formGroup]="form" novalidate>
<label for="inputEmail" class="sr-only">{{"login.form.email" | translate}}</label>

View File

@@ -1,13 +1,4 @@
<div>
<a class="btn btn-lg btn-primary btn-block mt-3" type="submit"
[href]="buttonHref"
role="button"
>{{"login.shibboleth" | translate}}</a>
</div>
<!--<form *ngIf="!(loading | async) && !(isAuthenticated | async)" class="form-login px-4 py-3" (ngSubmit)="submit()"-->
<form class="form-login px-4 py-3" (ngSubmit)="submit()"
<form *ngIf="!(loading | async) && !(isAuthenticated | async)"class="form-login px-4 py-3" (ngSubmit)="submit()"
[formGroup]="shibbForm" novalidate>
<button class="btn btn-lg btn-primary btn-block mt-3" type="submit"
[disabled]="!shibbForm.valid">{{"login.shibbForm.submit" | translate}}</button>

View File

@@ -1,8 +1,13 @@
import { Component, Inject, Input, OnInit } from '@angular/core';
import { Component, EventEmitter, Inject, Input, OnInit, Output, QueryList, ViewChildren } from '@angular/core';
import { renderAuthMethodFor } from '../../authMethods-decorator';
import { AuthMethodType } from '../../authMethods-type';
import { AuthMethodModel } from '../../../../core/auth/models/auth-method.model';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { FormBuilder, FormGroup } from '@angular/forms';
import { select, Store } from '@ngrx/store';
import { CoreState } from '../../../../core/core.reducers';
import { StartShibbolethAuthenticationAction } from '../../../../core/auth/auth.actions';
import { Observable } from 'rxjs';
import { isAuthenticated, isAuthenticationLoading } from '../../../../core/auth/selectors';
@Component({
selector: 'ds-dynamic-shibboleth',
@@ -15,7 +20,17 @@ export class DynamicShibbolethComponent implements OnInit {
@Input() authMethodModel: AuthMethodModel;
buttonHref: string;
/**
* True if the authentication is loading.
* @type {boolean}
*/
public loading: Observable<boolean>;
/**
* Whether user is authenticated.
* @type {Observable<string>}
*/
public isAuthenticated: Observable<boolean> ;
/**
* The authentication form.
@@ -27,9 +42,10 @@ export class DynamicShibbolethComponent implements OnInit {
* @constructor
*/
constructor(@Inject('authMethodModelProvider') public injectedAuthMethodModel: AuthMethodModel,
private formBuilder: FormBuilder) {
private formBuilder: FormBuilder,
private store: Store<CoreState>) {
this.authMethodModel = injectedAuthMethodModel;
this.buttonHref = ('https://fis.tiss.tuwien.ac.at' + this.authMethodModel.location + '/shibboleth')
// this.buttonHref = ('https://fis.tiss.tuwien.ac.at' + this.authMethodModel.location + '/shibboleth')
}
ngOnInit(): void {
@@ -38,9 +54,17 @@ export class DynamicShibbolethComponent implements OnInit {
this.shibbForm = this.formBuilder.group({
shibbButton: [''],
});
// set isAuthenticated
this.isAuthenticated = this.store.pipe(select(isAuthenticated));
// set loading
this.loading = this.store.pipe(select(isAuthenticationLoading));
}
submit() {
console.log('submit() was callled');
console.log('submit() was called');
this.store.dispatch(new StartShibbolethAuthenticationAction(this.authMethodModel))
}
}