From fdbca461a931db7b4de1611c367444b0b07a3730 Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Tue, 11 Jul 2023 15:14:44 +0800 Subject: [PATCH 01/20] Add minimal login component --- src/app/auth/login/login.component.css | 18 +++++++++++++++ src/app/auth/login/login.component.html | 4 ++++ src/app/auth/login/login.component.ts | 30 +++++++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 src/app/auth/login/login.component.css create mode 100644 src/app/auth/login/login.component.html create mode 100644 src/app/auth/login/login.component.ts diff --git a/src/app/auth/login/login.component.css b/src/app/auth/login/login.component.css new file mode 100644 index 00000000..dec75881 --- /dev/null +++ b/src/app/auth/login/login.component.css @@ -0,0 +1,18 @@ +.login-button { + background: #f7fcfe; + line-height: 45px; + border: 1px solid currentColor; + width: 100%; +} + +.logo { + align-items: center; + display: inline-flex; + margin: 0 3px 3px 3px; +} + +.github-logo { + font-size: 20px; + width: 20px; + height: 20px; +} diff --git a/src/app/auth/login/login.component.html b/src/app/auth/login/login.component.html new file mode 100644 index 00000000..244d4e60 --- /dev/null +++ b/src/app/auth/login/login.component.html @@ -0,0 +1,4 @@ + diff --git a/src/app/auth/login/login.component.ts b/src/app/auth/login/login.component.ts new file mode 100644 index 00000000..1163b15a --- /dev/null +++ b/src/app/auth/login/login.component.ts @@ -0,0 +1,30 @@ +import { Component, OnInit } from '@angular/core'; +import { AuthService, AuthState } from '../../core/services/auth.service'; +import { ErrorHandlingService } from '../../core/services/error-handling.service'; +import { LoggingService } from '../../core/services/logging.service'; + +@Component({ + selector: 'app-auth-login', + templateUrl: './login.component.html', + styleUrls: ['./login.component.css'] +}) + +export class LoginComponent implements OnInit { + constructor( + private authService: AuthService, + private errorHandlingService: ErrorHandlingService, + private logger: LoggingService + ) {} + + ngOnInit() {} + + startLoginProcess() { + this.logger.info('LoginComponent: Beginning login process'); + try { + this.authService.startOAuthProcess(); + } catch (error) { + this.errorHandlingService.handleError(error); + this.authService.changeAuthState(AuthState.NotAuthenticated); + } + } +} From 03137a31d8f82f8cc1ec8157654cd160338f8c2b Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Wed, 12 Jul 2023 11:57:21 +0800 Subject: [PATCH 02/20] Change auth process to login before selecting repo --- src/app/app.module.ts | 13 ++++- src/app/auth/auth.component.html | 17 ++++-- src/app/auth/auth.component.ts | 15 ++++++ src/app/auth/auth.module.ts | 10 +++- .../confirm-login/confirm-login.component.ts | 35 +------------ src/app/auth/login/login.component.html | 2 +- .../session-selection.component.ts | 12 +---- src/app/core/services/auth.service.ts | 52 ++++++++++++++++++- .../factories/factory.auth.service.ts | 15 +++++- 9 files changed, 117 insertions(+), 54 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 7a330a7a..2e5653f8 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -72,7 +72,18 @@ import { SharedModule } from './shared/shared.module'; { provide: AuthService, useFactory: AuthServiceFactory, - deps: [Router, NgZone, GithubService, UserService, IssueService, PhaseService, GithubEventService, Title, LoggingService] + deps: [ + Router, + NgZone, + GithubService, + UserService, + IssueService, + PhaseService, + GithubEventService, + Title, + ErrorHandlingService, + LoggingService + ] }, { provide: IssueService, diff --git a/src/app/auth/auth.component.html b/src/app/auth/auth.component.html index ee113cc7..7fded9ca 100644 --- a/src/app/auth/auth.component.html +++ b/src/app/auth/auth.component.html @@ -1,13 +1,17 @@
- - + + + + + +
-
+
+ +
+ + +
diff --git a/src/app/auth/auth.component.ts b/src/app/auth/auth.component.ts index a30274e5..c9a04eb5 100644 --- a/src/app/auth/auth.component.ts +++ b/src/app/auth/auth.component.ts @@ -25,6 +25,8 @@ export class AuthComponent implements OnInit, OnDestroy { currentUserName: string; urlEncodedSessionName: string; urlEncodedRepo: string; + sessionSetupState: boolean; + sessionSetupStateSubscription: Subscription; sessionInformation: string; constructor( @@ -51,6 +53,7 @@ export class AuthComponent implements OnInit, OnDestroy { } this.initAccessTokenSubscription(); this.initAuthStateSubscription(); + this.initSessionSetupStateSubscription(); this.createProfileFromUrlQueryParams(); this.getRepoFromUrlQueryParams(); if (oauthCode) { @@ -134,6 +137,10 @@ export class AuthComponent implements OnInit, OnDestroy { return this.authState === AuthState.ConfirmOAuthUser; } + isSettingUpSession(): boolean { + return this.sessionSetupState; + } + get currentSessionOrg(): string { if (!this.sessionInformation) { // Retrieve org details of session information from local storage @@ -158,6 +165,14 @@ export class AuthComponent implements OnInit, OnDestroy { }); } + private initSessionSetupStateSubscription() { + this.sessionSetupStateSubscription = this.authService.sessionSetupState.subscribe((state) => { + this.ngZone.run(() => { + this.sessionSetupState = state; + }); + }); + } + private initAccessTokenSubscription() { this.accessTokenSubscription = this.authService.accessToken .pipe( diff --git a/src/app/auth/auth.module.ts b/src/app/auth/auth.module.ts index 901bc391..46d81bbf 100644 --- a/src/app/auth/auth.module.ts +++ b/src/app/auth/auth.module.ts @@ -4,12 +4,20 @@ import { SharedModule } from '../shared/shared.module'; import { AuthRoutingModule } from './auth-routing.module'; import { AuthComponent } from './auth.component'; import { ConfirmLoginComponent } from './confirm-login/confirm-login.component'; +import { LoginComponent } from './login/login.component'; import { JsonParseErrorDialogComponent } from './profiles/json-parse-error-dialog/json-parse-error-dialog.component'; import { ProfilesComponent } from './profiles/profiles.component'; import { SessionSelectionComponent } from './session-selection/session-selection.component'; @NgModule({ imports: [AuthRoutingModule, SharedModule, CommonModule], - declarations: [AuthComponent, ProfilesComponent, JsonParseErrorDialogComponent, ConfirmLoginComponent, SessionSelectionComponent] + declarations: [ + AuthComponent, + ProfilesComponent, + JsonParseErrorDialogComponent, + LoginComponent, + ConfirmLoginComponent, + SessionSelectionComponent + ] }) export class AuthModule {} diff --git a/src/app/auth/confirm-login/confirm-login.component.ts b/src/app/auth/confirm-login/confirm-login.component.ts index 95df775e..a41a0d95 100644 --- a/src/app/auth/confirm-login/confirm-login.component.ts +++ b/src/app/auth/confirm-login/confirm-login.component.ts @@ -1,9 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; import { Router } from '@angular/router'; -import { Observable, of } from 'rxjs'; -import { mergeMap } from 'rxjs/operators'; import { Phase } from '../../core/models/phase.model'; -import { Repo } from '../../core/models/repo.model'; import { AuthService, AuthState } from '../../core/services/auth.service'; import { ErrorHandlingService } from '../../core/services/error-handling.service'; import { GithubService } from '../../core/services/github.service'; @@ -23,12 +20,9 @@ export class ConfirmLoginComponent implements OnInit { constructor( private authService: AuthService, - private phaseService: PhaseService, private userService: UserService, private errorHandlingService: ErrorHandlingService, - private githubEventService: GithubEventService, private logger: LoggingService, - private router: Router, public githubService: GithubService ) {} @@ -44,42 +38,16 @@ export class ConfirmLoginComponent implements OnInit { this.authService.startOAuthProcess(); } - /** - * Handles the clean up required after authentication and setting up of user data is completed. - */ - handleAuthSuccess() { - this.authService.setTitleWithPhaseDetail(); - this.router.navigateByUrl(Phase.issuesViewer); - this.authService.changeAuthState(AuthState.Authenticated); - } - /** * Will complete the process of logging in the given user. */ completeLoginProcess(): void { this.authService.changeAuthState(AuthState.AwaitingAuthentication); - this.phaseService.initializeCurrentRepository(); - this.logger.info(`ConfirmLoginComponent: Current repo is ${this.phaseService.currentRepo}`); this.userService .createUserModel(this.username) - .pipe( - mergeMap(() => { - const currentRepo = this.phaseService.currentRepo; - if (Repo.isInvalidRepoName(currentRepo)) { - return of(false); - } - return this.githubService.isRepositoryPresent(currentRepo.owner, currentRepo.name); - }), - mergeMap((isValidRepository) => { - if (!isValidRepository) { - return new Observable(); - } - return this.githubEventService.setLatestChangeEvent(); - }) - ) .subscribe( () => { - this.handleAuthSuccess(); + this.authService.changeSessionSetupState(true); }, (error) => { this.authService.changeAuthState(AuthState.NotAuthenticated); @@ -87,6 +55,5 @@ export class ConfirmLoginComponent implements OnInit { this.logger.info(`ConfirmLoginComponent: Completion of login process failed with an error: ${error}`); } ); - this.handleAuthSuccess(); } } diff --git a/src/app/auth/login/login.component.html b/src/app/auth/login/login.component.html index 244d4e60..afcde449 100644 --- a/src/app/auth/login/login.component.html +++ b/src/app/auth/login/login.component.html @@ -1,4 +1,4 @@ - diff --git a/src/app/auth/session-selection/session-selection.component.ts b/src/app/auth/session-selection/session-selection.component.ts index 997ed9ea..d6fdd73c 100644 --- a/src/app/auth/session-selection/session-selection.component.ts +++ b/src/app/auth/session-selection/session-selection.component.ts @@ -1,8 +1,7 @@ import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; import { FormBuilder, FormGroup, Validators } from '@angular/forms'; import { Profile } from '../../core/models/profile.model'; -import { AuthService, AuthState } from '../../core/services/auth.service'; -import { ErrorHandlingService } from '../../core/services/error-handling.service'; +import { AuthService } from '../../core/services/auth.service'; import { LoggingService } from '../../core/services/logging.service'; @Component({ @@ -25,7 +24,6 @@ export class SessionSelectionComponent implements OnInit { private formBuilder: FormBuilder, private logger: LoggingService, private authService: AuthService, - private errorHandlingService: ErrorHandlingService ) {} ngOnInit() { @@ -72,13 +70,7 @@ export class SessionSelectionComponent implements OnInit { this.logger.info(`SessionSelectionComponent: Selected Repository: ${repoInformation}`); - try { - this.authService.startOAuthProcess(); - } catch (error) { - this.errorHandlingService.handleError(error); - this.authService.changeAuthState(AuthState.NotAuthenticated); - this.isSettingUpSession = false; - } + this.authService.setupUserData(); } /** diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index 645b8192..bdef7d02 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -2,10 +2,13 @@ import { Injectable } from '@angular/core'; import { NgZone } from '@angular/core'; import { Title } from '@angular/platform-browser'; import { Router } from '@angular/router'; -import { BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, Observable } from 'rxjs'; +import { mergeMap } from 'rxjs/operators'; import { AppConfig } from '../../../environments/environment'; import { generateSessionId } from '../../shared/lib/session'; import { uuid } from '../../shared/lib/uuid'; +import { Phase } from '../models/phase.model'; +import { ErrorHandlingService } from './error-handling.service'; import { GithubService } from './github.service'; import { GithubEventService } from './githubevent.service'; import { IssueService } from './issue.service'; @@ -34,6 +37,9 @@ export class AuthService { accessToken = new BehaviorSubject(undefined); private state: string; + sessionSetupStateSource = new BehaviorSubject(false); + sessionSetupState = this.sessionSetupStateSource.asObservable(); + ENABLE_POPUP_MESSAGE = 'Please enable pop-ups in your browser'; constructor( @@ -45,8 +51,9 @@ export class AuthService { private phaseService: PhaseService, private githubEventService: GithubEventService, private titleService: Title, + private errorHandlingService: ErrorHandlingService, private logger: LoggingService - ) {} + ) {} /** * Will store the OAuth token. @@ -102,6 +109,10 @@ export class AuthService { this.authStateSource.next(newAuthState); } + changeSessionSetupState(newSessionSetupState: boolean) { + this.sessionSetupStateSource.next(newSessionSetupState); + } + /** * Generates and assigns an unguessable random 'state' string to pass to Github for protection against cross-site request forgery attacks */ @@ -133,6 +144,43 @@ export class AuthService { this.logger.info(`AuthService: Redirecting for Github authentication`); } + /** + * Handles the clean up required after authentication and setting up of user data is completed. + */ + handleAuthSuccess() { + this.setTitleWithPhaseDetail(); + this.router.navigateByUrl(Phase.issuesViewer); + this.changeAuthState(AuthState.Authenticated); + } + + /** + * Setup user data after authentication. + */ + setupUserData(): void { + this.phaseService.initializeCurrentRepository(); + const currentRepo = this.phaseService.currentRepo; + this.githubService.isRepositoryPresent(currentRepo.owner, currentRepo.name) + .pipe( + mergeMap((isValidRepository) => { + if (!isValidRepository) { + return new Observable(); + } + return this.githubEventService.setLatestChangeEvent(); + }) + ) + .subscribe( + () => { + this.handleAuthSuccess(); + }, + (error) => { + this.changeAuthState(AuthState.NotAuthenticated); + this.errorHandlingService.handleError(error); + this.logger.info(`AuthService: Completion of auth process failed with an error: ${error}`); + } + ); + this.handleAuthSuccess(); + } + /** * Will redirect to GitHub OAuth page */ diff --git a/src/app/core/services/factories/factory.auth.service.ts b/src/app/core/services/factories/factory.auth.service.ts index 2e9c762f..98fed5e8 100644 --- a/src/app/core/services/factories/factory.auth.service.ts +++ b/src/app/core/services/factories/factory.auth.service.ts @@ -3,6 +3,7 @@ import { Title } from '@angular/platform-browser'; import { Router } from '@angular/router'; // import { AppConfig } from '../../../../environments/environment'; import { AuthService } from '../auth.service'; +import { ErrorHandlingService } from '../error-handling.service'; import { GithubService } from '../github.service'; import { GithubEventService } from '../githubevent.service'; import { IssueService } from '../issue.service'; @@ -20,6 +21,7 @@ export function AuthServiceFactory( phaseService: PhaseService, githubEventService: GithubEventService, titleService: Title, + errorHandlingService: ErrorHandlingService, logger: LoggingService ) { // TODO: Write Mocks @@ -37,5 +39,16 @@ export function AuthServiceFactory( // ); // } console.log(logger); - return new AuthService(router, ngZone, githubService, userService, issueService, phaseService, githubEventService, titleService, logger); + return new AuthService( + router, + ngZone, + githubService, + userService, + issueService, + phaseService, + githubEventService, + titleService, + errorHandlingService, + logger + ); } From febec0a8fd767e14e049970e825a4dabc8781483 Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Wed, 12 Jul 2023 13:42:38 +0800 Subject: [PATCH 03/20] Add login component tests and edit existing tests --- .../confirm-login/confirm-login.component.ts | 4 -- .../confirm-login.component.spec.ts | 23 ++-------- tests/app/auth/login/login.component.spec.ts | 42 +++++++++++++++++++ 3 files changed, 45 insertions(+), 24 deletions(-) create mode 100644 tests/app/auth/login/login.component.spec.ts diff --git a/src/app/auth/confirm-login/confirm-login.component.ts b/src/app/auth/confirm-login/confirm-login.component.ts index a41a0d95..8cc06606 100644 --- a/src/app/auth/confirm-login/confirm-login.component.ts +++ b/src/app/auth/confirm-login/confirm-login.component.ts @@ -1,12 +1,8 @@ import { Component, Input, OnInit } from '@angular/core'; -import { Router } from '@angular/router'; -import { Phase } from '../../core/models/phase.model'; import { AuthService, AuthState } from '../../core/services/auth.service'; import { ErrorHandlingService } from '../../core/services/error-handling.service'; import { GithubService } from '../../core/services/github.service'; -import { GithubEventService } from '../../core/services/githubevent.service'; import { LoggingService } from '../../core/services/logging.service'; -import { PhaseService } from '../../core/services/phase.service'; import { UserService } from '../../core/services/user.service'; @Component({ diff --git a/tests/app/auth/confirm-login/confirm-login.component.spec.ts b/tests/app/auth/confirm-login/confirm-login.component.spec.ts index 5426e5d6..55eebc5c 100644 --- a/tests/app/auth/confirm-login/confirm-login.component.spec.ts +++ b/tests/app/auth/confirm-login/confirm-login.component.spec.ts @@ -1,5 +1,4 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { Router } from '@angular/router'; import { of } from 'rxjs'; import { ConfirmLoginComponent } from '../../../../src/app/auth/confirm-login/confirm-login.component'; import { Repo } from '../../../../src/app/core/models/repo.model'; @@ -7,9 +6,7 @@ import { User, UserRole } from '../../../../src/app/core/models/user.model'; import { AuthService } from '../../../../src/app/core/services/auth.service'; import { ErrorHandlingService } from '../../../../src/app/core/services/error-handling.service'; import { GithubService } from '../../../../src/app/core/services/github.service'; -import { GithubEventService } from '../../../../src/app/core/services/githubevent.service'; import { LoggingService } from '../../../../src/app/core/services/logging.service'; -import { PhaseService } from '../../../../src/app/core/services/phase.service'; import { UserService } from '../../../../src/app/core/services/user.service'; const mockUser: User = { @@ -21,35 +18,26 @@ const getRepoWithValidName = () => new Repo('mock', 'repo'); describe('ConfirmLoginComponent', () => { let authService: jasmine.SpyObj; - let phaseService: jasmine.SpyObj; let userService: jasmine.SpyObj; let errorHandlingService: jasmine.SpyObj; - let githubEventService: jasmine.SpyObj; let logger: jasmine.SpyObj; - let router: jasmine.SpyObj; let githubService: jasmine.SpyObj; let component: ConfirmLoginComponent; let fixture: ComponentFixture; beforeEach(async(() => { authService = jasmine.createSpyObj('AuthService', ['changeAuthState', 'setTitleWithPhaseDetail', 'startOAuthProcess']); - phaseService = jasmine.createSpyObj('PhaseService', ['initializeCurrentRepository', 'currentRepo']); logger = jasmine.createSpyObj('LoggingService', ['info']); userService = jasmine.createSpyObj('UserService', ['createUserModel']); githubService = jasmine.createSpyObj('GithubService', ['isRepositoryPresent']); - githubEventService = jasmine.createSpyObj('GithubEventService', ['setLatestChangeEvent']); - router = jasmine.createSpyObj('Router', ['navigateByUrl']); errorHandlingService = jasmine.createSpyObj('ErrorHandlingService', ['handleError']); TestBed.configureTestingModule({ providers: [ { provide: AuthService, useValue: authService }, - { provide: PhaseService, useValue: phaseService }, { provide: LoggingService, useValue: logger }, { provide: UserService, useValue: userService }, { provide: GithubService, useValue: githubService }, - { provide: GithubEventService, useValue: githubEventService }, - { provide: Router, useValue: router }, { provide: ErrorHandlingService, useValue: errorHandlingService } ], declarations: [ConfirmLoginComponent] @@ -61,22 +49,17 @@ describe('ConfirmLoginComponent', () => { })); it('should create', () => { - expect(component).toBeTruthy(); + expect(component).toBeFalsy(); }); - it('should complete login process with valid repo', () => { + it('should complete login process', () => { userService.createUserModel.and.returnValue(of(mockUser)); - phaseService.currentRepo = getRepoWithValidName(); githubService.isRepositoryPresent.and.returnValue(of(true)); component.completeLoginProcess(); expect(authService.changeAuthState).toHaveBeenCalled(); - expect(phaseService.initializeCurrentRepository).toHaveBeenCalled(); - expect(logger.info).toHaveBeenCalled(); expect(userService.createUserModel).toHaveBeenCalled(); - expect(githubService.isRepositoryPresent).toHaveBeenCalled(); - expect(githubEventService.setLatestChangeEvent).toHaveBeenCalled(); - expect(component.handleAuthSuccess).toHaveBeenCalledTimes(2); + expect(authService.changeSessionSetupState).toHaveBeenCalled(); }); }); diff --git a/tests/app/auth/login/login.component.spec.ts b/tests/app/auth/login/login.component.spec.ts new file mode 100644 index 00000000..d0c70131 --- /dev/null +++ b/tests/app/auth/login/login.component.spec.ts @@ -0,0 +1,42 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { LoginComponent } from '../../../../src/app/auth/login/login.component'; +import { AuthService } from '../../../../src/app/core/services/auth.service'; +import { ErrorHandlingService } from '../../../../src/app/core/services/error-handling.service'; +import { LoggingService } from '../../../../src/app/core/services/logging.service'; + +describe('LoginComponent', () => { + let authService: jasmine.SpyObj; + let errorHandlingService: jasmine.SpyObj; + let logger: jasmine.SpyObj; + let component: LoginComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + authService = jasmine.createSpyObj('AuthService', ['changeAuthState', 'setTitleWithPhaseDetail', 'startOAuthProcess']); + logger = jasmine.createSpyObj('LoggingService', ['info']); + errorHandlingService = jasmine.createSpyObj('ErrorHandlingService', ['handleError']); + + TestBed.configureTestingModule({ + providers: [ + { provide: AuthService, useValue: authService }, + { provide: LoggingService, useValue: logger }, + { provide: ErrorHandlingService, useValue: errorHandlingService } + ], + declarations: [LoginComponent] + }).compileComponents(); + + fixture = TestBed.createComponent(LoginComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + })); + + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should complete login process', () => { + component.startLoginProcess(); + + expect(authService.startOAuthProcess).toHaveBeenCalled(); + }); +}); \ No newline at end of file From 92c822ecf193c302ea40e62598218af50eae2055 Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Wed, 12 Jul 2023 13:55:26 +0800 Subject: [PATCH 04/20] Add newline at eof --- tests/app/auth/login/login.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/auth/login/login.component.spec.ts b/tests/app/auth/login/login.component.spec.ts index d0c70131..9f520468 100644 --- a/tests/app/auth/login/login.component.spec.ts +++ b/tests/app/auth/login/login.component.spec.ts @@ -39,4 +39,4 @@ describe('LoginComponent', () => { expect(authService.startOAuthProcess).toHaveBeenCalled(); }); -}); \ No newline at end of file +}); From bb4833f7e16defbc5bd84dfdbc38da9c510da945 Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Wed, 12 Jul 2023 13:55:41 +0800 Subject: [PATCH 05/20] Reset sessionSetupState --- src/app/core/services/auth.service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index bdef7d02..f49e054e 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -150,6 +150,7 @@ export class AuthService { handleAuthSuccess() { this.setTitleWithPhaseDetail(); this.router.navigateByUrl(Phase.issuesViewer); + this.changeSessionSetupState(false); this.changeAuthState(AuthState.Authenticated); } @@ -174,6 +175,7 @@ export class AuthService { }, (error) => { this.changeAuthState(AuthState.NotAuthenticated); + this.changeSessionSetupState(false); this.errorHandlingService.handleError(error); this.logger.info(`AuthService: Completion of auth process failed with an error: ${error}`); } From 6ff76b14004c4fb6f9f874e17781c36d57444622 Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Wed, 12 Jul 2023 14:28:10 +0800 Subject: [PATCH 06/20] Fix tests --- tests/app/auth/confirm-login/confirm-login.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/app/auth/confirm-login/confirm-login.component.spec.ts b/tests/app/auth/confirm-login/confirm-login.component.spec.ts index 55eebc5c..f0290e73 100644 --- a/tests/app/auth/confirm-login/confirm-login.component.spec.ts +++ b/tests/app/auth/confirm-login/confirm-login.component.spec.ts @@ -49,7 +49,7 @@ describe('ConfirmLoginComponent', () => { })); it('should create', () => { - expect(component).toBeFalsy(); + expect(component).toBeTruthy(); }); it('should complete login process', () => { From cac106c059d7ce1caab3a13a27d3fba2279e11a6 Mon Sep 17 00:00:00 2001 From: chia-yh <0.chiayuhong.0@gmail.com> Date: Sun, 16 Jul 2023 16:20:01 +0800 Subject: [PATCH 07/20] Address review comments --- src/app/auth/auth.component.html | 1 - src/app/auth/confirm-login/confirm-login.component.ts | 3 +-- src/app/auth/login/login.component.ts | 3 ++- .../session-selection/session-selection.component.ts | 2 ++ .../confirm-login/confirm-login.component.spec.ts | 11 ++--------- tests/app/auth/login/login.component.spec.ts | 5 +++-- 6 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/app/auth/auth.component.html b/src/app/auth/auth.component.html index 7fded9ca..022107bf 100644 --- a/src/app/auth/auth.component.html +++ b/src/app/auth/auth.component.html @@ -11,7 +11,6 @@