feat(login): add login authentication and authorization (#122)

Add login basic authentication, oauth2 authentication, two factor
authentication and authorization and allow to reset password on expiry.

Fixes #117, #118, #119, #120
This commit is contained in:
Abhay Chawla
2018-07-14 20:09:27 +05:30
committed by GitHub
parent 91e9744bb8
commit d9c35b8759
33 changed files with 953 additions and 271 deletions
@@ -0,0 +1,27 @@
<form fxLayout="column" [formGroup]="loginForm" (ngSubmit)="login()">
<mat-form-field fxFlexAlign="center" class="textfield">
<span matPrefix><mat-icon>account_circle</mat-icon>&nbsp;&nbsp;</span>
<input matInput placeholder="Username" autocomplete="off" formControlName="username">
<mat-error *ngIf="loginForm.controls.username.hasError('required')">
Username is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-form-field fxFlexAlign="center" class="textfield">
<span matPrefix><mat-icon>lock</mat-icon>&nbsp;&nbsp;</span>
<input matInput type="{{ passwordInputType }}" placeholder="Password" formControlName="password">
<button mat-button *ngIf="loginForm.controls.password.value && !loading" matSuffix mat-icon-button
aria-label="Clear" (mousedown)="passwordInputType = 'text'" (mouseup)="passwordInputType = 'password'">
<mat-icon *ngIf="passwordInputType === 'password'">visibility</mat-icon>
<mat-icon *ngIf="passwordInputType === 'text'">visibility_off</mat-icon>
</button>
<mat-error *ngIf="loginForm.controls.password.hasError('required')">
Password is <strong>required</strong>
</mat-error>
</mat-form-field>
<mat-checkbox fxFlexAlign="center" formControlName="remember" class="m-t-10">Remember me</mat-checkbox>
<button mat-raised-button color="primary" fxFlexAlign="center" class="btn" [disabled]="!loginForm.valid">
Login
<mat-spinner [diameter]="20" *ngIf="loading"></mat-spinner>
</button>
<button type="button" mat-button fxFlexAlign="center" class="btn" (click)="forgotPassword()" [disabled]="loading">Forgot Password?</button>
</form>