Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug/bug 7288 manage your delegated access application getting logout on button double click #2054

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Auth0Templates/LogIn.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="icon" type="image/x-icon" href="https://crown-commercial-service.github.io/conclave-ssso-ui/favicon.ico">
<link rel="icon" type="image/x-icon" href="https://crown-commercial-service.github.io/conclave-ssso-ui/faviconnew.ico">
<link rel="stylesheet" href="https://crown-commercial-service.github.io/conclave-ssso-ui/toolkit.styles.min.css">
<title>Sign In - CCS</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down Expand Up @@ -963,7 +963,7 @@ <h2 class="card-title">Guides</h2>
function forgotPassword(){
let lastUserEmail = document.getElementById("email").value
localStorage.setItem('lastUserEmail', lastUserEmail);
window.location.href = "https://dev.identify.crowncommercial.gov.uk/forgot-password?email="+lastUserEmail;
window.location.href = "https://dev.identify.crowncommercial.gov.uk/forgot-password?email="+encodeURIComponent(lastUserEmail);
}

let emailInput = document.getElementById("email");
Expand All @@ -972,7 +972,7 @@ <h2 class="card-title">Guides</h2>

email.addEventListener('input', function () {
lastUserEmail = emailInput.value;
forgotPwdLink.href = "https://dev.identify.crowncommercial.gov.uk/forgot-password?email="+lastUserEmail;
forgotPwdLink.href = "https://dev.identify.crowncommercial.gov.uk/forgot-password?email="+encodeURIComponent(lastUserEmail);
});

window.addEventListener('load', function () {
Expand Down
2 changes: 1 addition & 1 deletion Auth0Templates/Mfa.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" type="image/x-icon"
href="https://res.cloudinary.com/ccssiteimage/image/upload/v1613109629/site/favicon_gfqibc.ico">
href="https://crown-commercial-service.github.io/conclave-ssso-ui/faviconnew.ico">
<link rel="stylesheet" href="https://crown-commercial-service.github.io/conclave-ssso-ui/toolkit.styles.min.css">
<title>Sign In - CCS</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
Expand Down
2 changes: 1 addition & 1 deletion Auth0Templates/ResetPassword.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="icon" type="image/x-icon"
href="https://res.cloudinary.com/ccssiteimage/image/upload/v1613109629/site/favicon_gfqibc.ico">
href="https://crown-commercial-service.github.io/conclave-ssso-ui/faviconnew.ico">
<title>Set Password - CCS</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Google Tag Manager -->
Expand Down
4 changes: 2 additions & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/faviconnew.ico",
"src/assets",
{
"glob": "**/*",
Expand Down Expand Up @@ -216,7 +216,7 @@
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/faviconnew.ico",
"src/assets"
],
"styles": [
Expand Down
36 changes: 18 additions & 18 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ import { ManageUserDeleteConfirmComponent } from './pages/manage-user/manage-use
import { ManageOrganisationErrorComponent } from './pages/manage-organisation/manage-organisation-error/manage-organisation-error.component';
import { ContactUsComponent } from './pages/contactus/contactus.component';
import { BuyerSearchComponent } from './pages/buyer/search/search.component';
import { BuyerConfirmComponent } from './pages/buyer/confirm/confirm.component';
// import { BuyerConfirmComponent } from './pages/buyer/confirm/confirm.component';
import { BuyerDetailsComponent } from './pages/buyer/details/details.component';
import { BuyerSuccessComponent } from './pages/buyer/success/success.component';
import { OrgSupportSuccessComponent } from './pages/org-support/success/success.component';
Expand Down Expand Up @@ -823,13 +823,13 @@ const routes: Routes = [
canActivate: [MaintenanceCheck, AuthGuard, RoleGuard,DormancyGuard],
component: BuyerDetailsComponent,
},
{
path: 'buyer/confirm/:id',
data: { title: 'Review - Manage Buyers', roles: ['MANAGE_SUBSCRIPTIONS'] },
pathMatch: 'full',
canActivate: [MaintenanceCheck, AuthGuard, RoleGuard,DormancyGuard],
component: BuyerConfirmComponent,
},
// {
// path: 'buyer/confirm/:id',
// data: { title: 'Review - Manage Buyers', roles: ['MANAGE_SUBSCRIPTIONS'] },
// pathMatch: 'full',
// canActivate: [MaintenanceCheck, AuthGuard, RoleGuard,DormancyGuard],
// component: BuyerConfirmComponent,
// },
{
path: 'update-org-type/confirm',
data: { title: 'Review - Manage Buyers', roles: ['MANAGE_SUBSCRIPTIONS'] },
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ import { ManageUserDeleteConfirmComponent } from './pages/manage-user/manage-use
import { ManageOrganisationErrorComponent } from './pages/manage-organisation/manage-organisation-error/manage-organisation-error.component';
import { ContactUsComponent } from './pages/contactus/contactus.component';
import { BuyerSearchComponent } from './pages/buyer/search/search.component';
import { BuyerConfirmComponent } from './pages/buyer/confirm/confirm.component';
// import { BuyerConfirmComponent } from './pages/buyer/confirm/confirm.component';
import { BuyerDetailsComponent } from './pages/buyer/details/details.component';
import { BuyerSuccessComponent } from './pages/buyer/success/success.component';
import { OrgSupportSearchComponent } from './pages/org-support/search/search.component';
Expand Down Expand Up @@ -304,7 +304,7 @@ export function createTranslateLoader(http: HttpClient) {
ManageOrganisationErrorComponent,
BuyerSearchComponent,
BuyerDetailsComponent,
BuyerConfirmComponent,
// BuyerConfirmComponent,
BuyerSuccessComponent,
OrgSupportSearchComponent,
OrgSupportDetailsComponent,
Expand Down
12 changes: 6 additions & 6 deletions src/app/pages/buyer/confirm-changes/confirm.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ describe('BuyerConfirmChangesComponent', () => {
expect(component.org$).toBeInstanceOf(Observable);
});

it('should navigate to the confirm page with the correct ID when onBackClick is called', () => {
const routerSpy = spyOn(component.router, 'navigateByUrl');
// it('should navigate to the confirm page with the correct ID when onBackClick is called', () => {
// const routerSpy = spyOn(component.router, 'navigateByUrl');

component.org = { ciiOrganisationId: 1 };
// component.org = { ciiOrganisationId: 1 };

component.onBackClick();
// component.onBackClick();

expect(routerSpy).toHaveBeenCalledWith('buyer/confirm/1');
});
// expect(routerSpy).toHaveBeenCalledWith('buyer/confirm/1');
// });
});
2 changes: 1 addition & 1 deletion src/app/pages/buyer/confirm-changes/confirm.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class BuyerConfirmChangesComponent extends BaseComponent {

public onBackClick(buttonText:string) {
localStorage.removeItem(`mse_org_${this.org.ciiOrganisationId}`);
this.router.navigateByUrl('buyer/confirm/' + this.org.ciiOrganisationId);
// this.router.navigateByUrl('buyer/confirm/' + this.org.ciiOrganisationId);
this.pushDataLayerEvent(buttonText);
}
}
7 changes: 5 additions & 2 deletions src/app/pages/buyer/confirm/confirm.component.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
<!-- Task 7271: Code Climate - Complex Logical Expression
Not in use will be removed in some time -->

<!--<app-sidenav [collapsed]="sideNavVisible$ | async"></app-sidenav>-->
<div class="content flex" *ngIf="org$ | async as o">
<!-- <div class="content flex" *ngIf="org$ | async as o">
<div class="govuk-breadcrumbs">
<ol class="govuk-breadcrumbs__list">
<li class="govuk-breadcrumbs__list-item">
Expand Down Expand Up @@ -268,4 +271,4 @@ <h1 class="govuk-heading-xl page-title">
Cancel
</button>
</div>
</div>
</div> -->
25 changes: 14 additions & 11 deletions src/app/pages/buyer/confirm/confirm.component.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
app-buyer-confirm {
input[type=radio] {
width: 150px;
height: 50px;
margin-right: 10px;
top: 3px;
}
// input[type='radio']:checked:after {
// background-color: #ffa500;
// }
}
// Task 7271: Code Climate - Complex Logical Expression
// Not in use will be removed in some time

// app-buyer-confirm {
// input[type=radio] {
// width: 150px;
// height: 50px;
// margin-right: 10px;
// top: 3px;
// }
// // input[type='radio']:checked:after {
// // background-color: #ffa500;
// // }
// }
121 changes: 62 additions & 59 deletions src/app/pages/buyer/confirm/confirm.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,71 +1,74 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { ReactiveFormsModule, FormGroup } from '@angular/forms';
import { ActivatedRoute, Router } from '@angular/router';
import { Store } from '@ngrx/store';
import { Observable, of } from 'rxjs';
import { BuyerConfirmComponent } from './confirm.component';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { TranslateModule } from '@ngx-translate/core';
// Task 7271: Code Climate - Complex Logical Expression
// Not in use will be removed in some time

describe('BuyerConfirmComponent', () => {
let component: BuyerConfirmComponent;
let fixture: ComponentFixture<BuyerConfirmComponent>;
let mockRouter: any;
let mockStore: any;
// import { ComponentFixture, TestBed } from '@angular/core/testing';
// import { ReactiveFormsModule, FormGroup } from '@angular/forms';
// import { ActivatedRoute, Router } from '@angular/router';
// import { Store } from '@ngrx/store';
// import { Observable, of } from 'rxjs';
// import { BuyerConfirmComponent } from './confirm.component';
// import { HttpClientTestingModule } from '@angular/common/http/testing';
// import { TranslateModule } from '@ngx-translate/core';

beforeEach(async () => {
mockRouter = jasmine.createSpyObj('Router', ['navigateByUrl']);
const activatedRouteStub = () => ({
params: { subscribe: (f: any) => f({ id: '123' }) },
});
mockStore = jasmine.createSpyObj('Store', ['dispatch']);
// describe('BuyerConfirmComponent', () => {
// let component: BuyerConfirmComponent;
// let fixture: ComponentFixture<BuyerConfirmComponent>;
// let mockRouter: any;
// let mockStore: any;

await TestBed.configureTestingModule({
imports: [
ReactiveFormsModule,
HttpClientTestingModule,
TranslateModule.forRoot(),
],
declarations: [BuyerConfirmComponent],
providers: [
{ provide: Router, useValue: mockRouter },
{ provide: ActivatedRoute, useFactory: activatedRouteStub },
{ provide: Store, useValue: mockStore },
],
}).compileComponents();
});
// beforeEach(async () => {
// mockRouter = jasmine.createSpyObj('Router', ['navigateByUrl']);
// const activatedRouteStub = () => ({
// params: { subscribe: (f: any) => f({ id: '123' }) },
// });
// mockStore = jasmine.createSpyObj('Store', ['dispatch']);

beforeEach(() => {
fixture = TestBed.createComponent(BuyerConfirmComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
// await TestBed.configureTestingModule({
// imports: [
// ReactiveFormsModule,
// HttpClientTestingModule,
// TranslateModule.forRoot(),
// ],
// declarations: [BuyerConfirmComponent],
// providers: [
// { provide: Router, useValue: mockRouter },
// { provide: ActivatedRoute, useFactory: activatedRouteStub },
// { provide: Store, useValue: mockStore },
// ],
// }).compileComponents();
// });

it('should create the component', () => {
expect(component).toBeTruthy();
});
// beforeEach(() => {
// fixture = TestBed.createComponent(BuyerConfirmComponent);
// component = fixture.componentInstance;
// fixture.detectChanges();
// });

it('should initialize the form correctly', () => {
expect(component.userProfileForm).toBeTruthy();
expect(component.userProfileForm instanceof FormGroup).toBeTrue();
expect(component.rolesToAdd).toEqual([]);
expect(component.rolesToDelete).toEqual([]);
});
// it('should create the component', () => {
// expect(component).toBeTruthy();
// });

it('should handle the "onChange" method correctly', () => {
const event = { target: { checked: true } };
let defaultValue = true;
const role = { roleId: 1, enabled: true, roleKey: '1', roleName: '1' };
// it('should initialize the form correctly', () => {
// expect(component.userProfileForm).toBeTruthy();
// expect(component.userProfileForm instanceof FormGroup).toBeTrue();
// expect(component.rolesToAdd).toEqual([]);
// expect(component.rolesToDelete).toEqual([]);
// });

component.onChange(event, defaultValue, role);
// it('should handle the "onChange" method correctly', () => {
// const event = { target: { checked: true } };
// let defaultValue = true;
// const role = { roleId: 1, enabled: true, roleKey: '1', roleName: '1' };

expect(component.rolesToDelete).toEqual([]);
// component.onChange(event, defaultValue, role);

event.target.checked = false;
defaultValue = false;
// expect(component.rolesToDelete).toEqual([]);

component.onChange(event, defaultValue, role);
// event.target.checked = false;
// defaultValue = false;

expect(component.rolesToAdd).toEqual([]);
});
});
// component.onChange(event, defaultValue, role);

// expect(component.rolesToAdd).toEqual([]);
// });
// });
Loading