upgrade to newest backend
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import {Component, OnInit} from '@angular/core';
|
||||
import {FormBuilder, FormGroup, Validators} from '@angular/forms';
|
||||
import {Auth2FAService} from '../../services/auth.2fa.service';
|
||||
import {Router, ActivatedRoute} from '@angular/router';
|
||||
|
||||
import { environment } from '../../../environments/environment';
|
||||
import {environment} from '../../../environments/environment';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
@@ -17,7 +17,7 @@ export class LoginTotpComponent implements OnInit {
|
||||
public apiUrl = environment.apiUrl;
|
||||
targetRoute = '/account/info';
|
||||
|
||||
constructor(private formBuilder: FormBuilder, private authService: AuthService, private router: Router, private route: ActivatedRoute) { }
|
||||
constructor(private formBuilder: FormBuilder, private auth2FAService: Auth2FAService, private router: Router, private route: ActivatedRoute) {}
|
||||
|
||||
|
||||
ngOnInit() {
|
||||
@@ -27,7 +27,7 @@ export class LoginTotpComponent implements OnInit {
|
||||
});
|
||||
|
||||
this.route.queryParams.subscribe(params => {
|
||||
if (params['target']) {
|
||||
if(params['target']) {
|
||||
this.targetRoute = params['target'];
|
||||
}
|
||||
});
|
||||
@@ -35,14 +35,8 @@ export class LoginTotpComponent implements OnInit {
|
||||
|
||||
async loginTotp() {
|
||||
this.loginInvalid = false;
|
||||
if (this.form.valid) {
|
||||
|
||||
const totpModel = {
|
||||
code: this.form.get('code').value,
|
||||
keep: this.form.get('keep').value
|
||||
};
|
||||
|
||||
this.authService.loginTotp(totpModel).subscribe((response: any) => {
|
||||
if(this.form.valid) {
|
||||
this.auth2FAService.login('totp', this.form.get('code').value, this.form.get('keep').value).subscribe((response: any) => {
|
||||
this.router.navigate([this.targetRoute]);
|
||||
}, error => {
|
||||
this.loginInvalid = true;
|
||||
|
||||
Reference in New Issue
Block a user