mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
#2962 IPAd Login Fix
This commit is contained in:
@@ -16,8 +16,13 @@ import {
|
||||
} from './guards';
|
||||
import { BranchSectionResolver, CustomerSectionResolver, ProcessIdResolver } from './resolvers';
|
||||
import { ShellComponent, ShellModule } from './shell';
|
||||
import { TokenLoginComponent, TokenLoginModule } from './token-login';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: 'login',
|
||||
children: [{ path: ':token', component: TokenLoginComponent }],
|
||||
},
|
||||
{
|
||||
path: '',
|
||||
canActivate: [IsAuthenticatedGuard],
|
||||
@@ -107,7 +112,7 @@ const routes: Routes = [
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes), ShellModule],
|
||||
imports: [RouterModule.forRoot(routes), ShellModule, TokenLoginModule],
|
||||
exports: [RouterModule],
|
||||
})
|
||||
export class AppRoutingModule {}
|
||||
|
||||
2
apps/isa-app/src/app/token-login/index.ts
Normal file
2
apps/isa-app/src/app/token-login/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './token-login.component';
|
||||
export * from './token-login.module';
|
||||
22
apps/isa-app/src/app/token-login/token-login.component.ts
Normal file
22
apps/isa-app/src/app/token-login/token-login.component.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AuthService } from '@core/auth';
|
||||
|
||||
@Component({
|
||||
selector: 'app-token-login',
|
||||
templateUrl: 'token-login.component.html',
|
||||
styleUrls: ['token-login.component.scss'],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class TokenLoginComponent implements OnInit {
|
||||
constructor(private _route: ActivatedRoute, private _authService: AuthService, private _router: Router) {}
|
||||
|
||||
ngOnInit() {
|
||||
if (this._route.snapshot.params.token && !this._authService.isAuthenticated()) {
|
||||
this._authService.setKeyCardToken(this._route.snapshot.params.token);
|
||||
this._authService.login();
|
||||
} else {
|
||||
this._router.navigate(['/']);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
apps/isa-app/src/app/token-login/token-login.module.ts
Normal file
11
apps/isa-app/src/app/token-login/token-login.module.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { NgModule } from '@angular/core';
|
||||
import { CommonModule } from '@angular/common';
|
||||
|
||||
import { TokenLoginComponent } from './token-login.component';
|
||||
|
||||
@NgModule({
|
||||
imports: [CommonModule],
|
||||
exports: [TokenLoginComponent],
|
||||
declarations: [TokenLoginComponent],
|
||||
})
|
||||
export class TokenLoginModule {}
|
||||
Reference in New Issue
Block a user