This commit is contained in:
_Bastler 2021-05-19 21:10:54 +02:00
parent 5304409ea4
commit 9ab0b9553c
3 changed files with 13 additions and 3 deletions

View File

@ -1,4 +1,4 @@
<form action="{{apiUrl}}/auth/formlogin/totp" method="POST" #totpForm>
<form action="{{apiUrl}}/auth/login/totp" method="POST" #totpForm>
<mat-card>
<mat-card-content>
<h2>{{'security.2fa.totp.external' | i18n}}<mat-icon style="font-size: 1em;">open_in_new
@ -13,6 +13,9 @@
{{'security.2fa.totp.missing' | i18n}}
</mat-error>
</mat-form-field>
<mat-slide-toggle id="keep" name="keep" [checked]="keep" >
{{'login.keepSession' | i18n}}
</mat-slide-toggle>
</mat-card-content>
<mat-card-actions>
<button type="submit" mat-raised-button color="primary" (click)="totpForm.submit()"

View File

@ -1,6 +1,5 @@
import {Component, OnInit} from '@angular/core';
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
import {ActivatedRoute} from '@angular/router';
import {ActivatedRoute, Router} from '@angular/router';
import {environment} from '../../../environments/environment';
@ -12,15 +11,22 @@ import {environment} from '../../../environments/environment';
export class FormLoginTotpComponent implements OnInit {
loginInvalid: boolean;
keep: boolean = false;
apiUrl = environment.apiUrl;
constructor(
private router: Router,
private route: ActivatedRoute) {}
async ngOnInit() {
this.route.queryParams.subscribe(params => {
if(params['error'] || params['error'] == '') {
this.loginInvalid = true;
this.router.navigate([], {queryParams: {error: null}, queryParamsHandling: 'merge'});
}
if(params['keep'] || params['keep'] == '') {
this.keep = true;
this.router.navigate([], {queryParams: {keep: null}, queryParamsHandling: 'merge'});
}
});
}

View File

@ -27,6 +27,7 @@ export class FormLoginComponent implements OnInit {
}
if(params['error'] || params['error'] == '') {
this.loginInvalid = true;
this.router.navigate([], {queryParams: {error: null}, queryParamsHandling: 'merge'});
}
});