remove unused components
This commit is contained in:
@@ -18,7 +18,6 @@ import { MainComponent } from './ui/main/main.component';
|
|||||||
import { AccountComponent } from './pages/account/account.component';
|
import { AccountComponent } from './pages/account/account.component';
|
||||||
import { ServicesComponent } from './pages/services/services.component';
|
import { ServicesComponent } from './pages/services/services.component';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { LoginComponent } from './pages/login/login.component';
|
|
||||||
import { FormLoginComponent } from './pages/form-login/form-login.component';
|
import { FormLoginComponent } from './pages/form-login/form-login.component';
|
||||||
import { FormLogin2FAComponent } from './pages/form-login-2fa/form-login-2fa.component';
|
import { FormLogin2FAComponent } from './pages/form-login-2fa/form-login-2fa.component';
|
||||||
import { TokensComponent } from './pages/tokens/tokens.component';
|
import { TokensComponent } from './pages/tokens/tokens.component';
|
||||||
@@ -129,7 +128,6 @@ export class XhrInterceptor implements HttpInterceptor {
|
|||||||
MainComponent,
|
MainComponent,
|
||||||
AppComponent,
|
AppComponent,
|
||||||
AccountComponent,
|
AccountComponent,
|
||||||
LoginComponent,
|
|
||||||
FormLoginComponent,
|
FormLoginComponent,
|
||||||
FormLogin2FAComponent,
|
FormLogin2FAComponent,
|
||||||
FormLoginOidcComponent,
|
FormLoginOidcComponent,
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
<form [formGroup]="form" (ngSubmit)="loginTotp()">
|
|
||||||
<mat-card>
|
|
||||||
<mat-card-content>
|
|
||||||
<h2>{{'security.2fa.totp' | i18n}}</h2>
|
|
||||||
@if (loginInvalid) {
|
|
||||||
<mat-error>
|
|
||||||
{{'security.2fa.totp.invalid' | i18n}}
|
|
||||||
</mat-error>
|
|
||||||
}
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-label>{{'security.2fa.totp.code' | i18n}}</mat-label>
|
|
||||||
<input id="code" name="code" matInput formControlName="code"
|
|
||||||
required matAutofocus>
|
|
||||||
<mat-error>
|
|
||||||
{{'security.2fa.totp.missing' | i18n}}
|
|
||||||
</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-slide-toggle id="keep" name="keep" formControlName="keep">
|
|
||||||
{{'security.2fa.totp.keepSession' | i18n}}
|
|
||||||
</mat-slide-toggle>
|
|
||||||
</mat-card-content>
|
|
||||||
<mat-card-actions>
|
|
||||||
<a type="submit" mat-raised-button color="primary"
|
|
||||||
[disabled]="form.invalid">{{'security.2fa.totp.login' | i18n}}</a>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
||||||
</form>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
mat-form-field {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { Auth2FAService } from '../../services/auth.2fa.service';
|
|
||||||
|
|
||||||
import { environment } from '../../../environments/environment';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
standalone: false,
|
|
||||||
selector: 'app-login-totp',
|
|
||||||
templateUrl: './login-totp.component.html',
|
|
||||||
styleUrls: ['./login-totp.component.scss']
|
|
||||||
})
|
|
||||||
export class LoginTotpComponent implements OnInit {
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
public loginInvalid: boolean;
|
|
||||||
public apiUrl = environment.apiUrl;
|
|
||||||
targetRoute = '/account/info';
|
|
||||||
|
|
||||||
constructor(private formBuilder: FormBuilder, private auth2FAService: Auth2FAService, private router: Router, private route: ActivatedRoute) { }
|
|
||||||
|
|
||||||
|
|
||||||
ngOnInit() {
|
|
||||||
this.form = this.formBuilder.group({
|
|
||||||
code: ['', Validators.required],
|
|
||||||
keep: ['']
|
|
||||||
});
|
|
||||||
|
|
||||||
this.route.queryParams.subscribe({
|
|
||||||
next: (params) => {
|
|
||||||
if (params['target']) {
|
|
||||||
this.targetRoute = params['target'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async loginTotp() {
|
|
||||||
this.loginInvalid = false;
|
|
||||||
if (this.form.valid) {
|
|
||||||
this.auth2FAService.login('totp', this.form.get('code').value, this.form.get('keep').value).subscribe({
|
|
||||||
next: (response: any) => {
|
|
||||||
this.router.navigate([this.targetRoute]);
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
this.loginInvalid = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
<form [formGroup]="form" (ngSubmit)="login()">
|
|
||||||
<mat-card>
|
|
||||||
<mat-card-content>
|
|
||||||
<h2>{{'login' | i18n}}</h2>
|
|
||||||
@if (loginInvalid) {
|
|
||||||
<mat-error>
|
|
||||||
{{'login.invalid' | i18n}}
|
|
||||||
</mat-error>
|
|
||||||
}
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-label>{{'username' | i18n}}</mat-label>
|
|
||||||
<input id="username" name="username" matInput
|
|
||||||
formControlName="username" required matAutofocus>
|
|
||||||
<mat-error>
|
|
||||||
{{'username.missing' | i18n}}
|
|
||||||
</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-form-field>
|
|
||||||
<mat-label>{{'password' | i18n}}</mat-label>
|
|
||||||
<input id="password" name="password" matInput type="password"
|
|
||||||
formControlName="password" required>
|
|
||||||
<mat-error>
|
|
||||||
{{'password.invalid.hint' | i18n}}
|
|
||||||
</mat-error>
|
|
||||||
</mat-form-field>
|
|
||||||
<mat-slide-toggle id="keep" name="keep" formControlName="keep">
|
|
||||||
{{'login.keepSession' | i18n}}
|
|
||||||
</mat-slide-toggle>
|
|
||||||
</mat-card-content>
|
|
||||||
<mat-card-actions>
|
|
||||||
<button type="submit" type="submit" mat-raised-button color="primary"
|
|
||||||
[disabled]="form.invalid">{{'login' | i18n}}</button>
|
|
||||||
<a routerLink="/password" mat-raised-button color="warn">{{'password.forgot' | i18n}}</a>
|
|
||||||
</mat-card-actions>
|
|
||||||
</mat-card>
|
|
||||||
</form>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
mat-form-field {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
@@ -1,71 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
|
||||||
import { AuthService } from './../../services/auth.service';
|
|
||||||
|
|
||||||
import { environment } from './../../../environments/environment';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
standalone: false,
|
|
||||||
selector: 'app-login',
|
|
||||||
templateUrl: './login.component.html',
|
|
||||||
styleUrls: ['./login.component.scss']
|
|
||||||
})
|
|
||||||
export class LoginComponent implements OnInit {
|
|
||||||
|
|
||||||
form: FormGroup;
|
|
||||||
public loginInvalid: boolean;
|
|
||||||
public apiUrl = environment.apiUrl;
|
|
||||||
targetRoute = '/services';
|
|
||||||
loginModel = {};
|
|
||||||
|
|
||||||
constructor(
|
|
||||||
private formBuilder: FormBuilder,
|
|
||||||
private authService: AuthService,
|
|
||||||
private router: Router,
|
|
||||||
private route: ActivatedRoute) { }
|
|
||||||
|
|
||||||
async ngOnInit() {
|
|
||||||
this.form = this.formBuilder.group({
|
|
||||||
username: ['', Validators.required],
|
|
||||||
password: ['', Validators.required],
|
|
||||||
keep: ['']
|
|
||||||
});
|
|
||||||
|
|
||||||
this.route.queryParams.subscribe({
|
|
||||||
next: (params) => {
|
|
||||||
if (params['target']) {
|
|
||||||
this.targetRoute = params['target'];
|
|
||||||
this.router.navigate([], { queryParams: { target: null }, queryParamsHandling: 'merge' });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async login() {
|
|
||||||
this.loginInvalid = false;
|
|
||||||
if (this.form.valid) {
|
|
||||||
|
|
||||||
const loginModel = {
|
|
||||||
username: this.form.get('username').value,
|
|
||||||
password: this.form.get('password').value,
|
|
||||||
keep: this.form.get('keep').value
|
|
||||||
};
|
|
||||||
|
|
||||||
this.authService.login(loginModel).subscribe({
|
|
||||||
next: (response: any) => {
|
|
||||||
this.router.navigate([this.targetRoute]);
|
|
||||||
},
|
|
||||||
error: (error) => {
|
|
||||||
if (error.status == 428) {
|
|
||||||
this.router.navigate(["/login/totp"], { queryParams: { target: this.targetRoute } });
|
|
||||||
} else {
|
|
||||||
this.loginInvalid = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user