Skip to content

Commit

Permalink
Merge pull request #811 from Crown-Commercial-Service/p2sprint15
Browse files Browse the repository at this point in the history
P2sprint15 merge with Main
  • Loading branch information
ponselvamsakthivel-bc authored Oct 18, 2022
2 parents 7ffed8b + dd26967 commit 271cf83
Show file tree
Hide file tree
Showing 46 changed files with 453 additions and 199 deletions.
17 changes: 2 additions & 15 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,5 @@
language: node_js
node_js:
- 12.16.1
addons:
chrome: stable
cache:
directories:
- "./node_modules"
install:
- npm install
before_script:
- npm install -g @angular/cli
script: npm run build
after_script: ls
language: node_js
dist: focal
node_js:
- 12.16.1
addons:
Expand Down Expand Up @@ -40,4 +27,4 @@ before_deploy:
- wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
- echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
- sudo apt-get -qq update
- sudo apt-get install cf7-cli
- sudo apt-get install cf7-cli
2 changes: 1 addition & 1 deletion Auth0Templates/LogIn.html
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ <h1 class="govuk-heading-m">If you don’t have an account you can create an acc
password</a>
<br />
</div>
<div class="govuk-grid-row fed-log">
<div class="govuk-grid-row fed-log" style="display: none;">
<label class="govuk-label fed-log-lable">Or, if configured sign in with:</label>
<div class="govuk-grid-column-two-thirds">
<div class="govuk-grid-row">
Expand Down
68 changes: 37 additions & 31 deletions Auth0Templates/ResetPassword.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,29 @@
href="https://res.cloudinary.com/ccssiteimage/image/upload/v1613109629/site/favicon_gfqibc.ico">
<title>Set Password - CCS</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- GA4 script -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-624NHLKTKL"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-624NHLKTKL');
</script>
<!-- GA4 script -->
<!-- Google Tag Manager -->
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-TZCX5VP');
</script>
<!-- End Google Tag Manager -->
<!-- GA4 script -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-624NHLKTKL"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-624NHLKTKL');
</script>
<!-- GA4 script -->
<!-- Google Tag Manager -->
<script>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({ 'gtm.start': new Date().getTime(), event: 'gtm.js' });
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', 'GTM-TZCX5VP');
</script>
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous"> -->
<link rel="stylesheet"
href="https://crown-commercial-service.github.io/conclave-ssso-ui/toolkit.styles.min.css">
Expand Down Expand Up @@ -305,10 +304,10 @@
</style>

<body class="govuk-template__body show-flourishes pillar--none js-enabled">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TZCX5VP" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TZCX5VP" height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<header class="header-global">
<div class="ccs-width-container">
<div class="nav-wrapper">
Expand Down Expand Up @@ -519,8 +518,6 @@ <h2 class="govuk-error-summary__title" id="error-summary-title">

var password = $("#newPassword");
var confirmPassword = $("#confirmNewPassword");

debugger;
let passwordFG = document.getElementById('password-form-group');
let confirmPasswordFG = document.getElementById('confirmPassword-form-group');
passwordFG.classList.remove("invalid");
Expand All @@ -541,12 +538,21 @@ <h2 class="govuk-error-summary__title" id="error-summary-title">
displayErrorMessage(passwordEmpty, confirmPasswordEmpty);
return;
}
if(password.val()){
const isContainsSymbol = /^(?=.*[~`!@#$%^&*()--+={}\[\]|\\:;"'<>,.?/_£]).*$/;
const isContainsUppercase = /^(?=.*[A-Z]).*$/;
const isContainsLowercase = /^(?=.*[a-z]).*$/;
if (!isContainsSymbol.test(password.val()) || !isContainsUppercase.test(password.val()) || !isContainsLowercase.test(password.val())) {
displayErrorMessage(false, false, "Password does not align to the policy");
return ;
}
}

if (password.val() != confirmPassword.val()) {
displayErrorMessage(false, false, "Passwords do not match");
return;
}

$.ajax({
type: form.attr('method'),
url: form.attr('action'),
Expand Down
15 changes: 11 additions & 4 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ import { DelegatedErrorComponent } from './pages/manage-delegated/delegated-erro
import { DelegatedUserActivationComponent } from './pages/manage-delegated/landing-pages/delegated-user-activation/delegated-user-activation.component';
import { DelegatedOrganisationComponent } from './pages/manage-delegated/user/delegated-organisation/delegated-organisation.component';
import { TermsConditionsComponent } from './components/terms-conditions/terms-conditions.component';
import { ForgotPasswordErrorComponent } from './pages/forgot-password-error/forgot-password-error.component';

const routes: Routes = [
{ path: '', redirectTo: 'home', pathMatch: 'full' },
Expand Down Expand Up @@ -232,6 +233,12 @@ const routes: Routes = [
pathMatch: 'full',
component: ForgotPasswordSuccessComponent,
},
{
path: 'forgot-password-error',
data: { title: 'Error - Forgot Password' },
pathMatch: 'full',
component: ForgotPasswordErrorComponent,
},
{
path: 'resend-link-success',
data: { title: 'Success - Resend Link' },
Expand Down Expand Up @@ -936,14 +943,14 @@ const routes: Routes = [
},
{
path: 'delegated-access',
data: { title: 'delegated-access', roles: ['DELEGATED_ACCESS'] },
data: { title: 'Delegated access', roles: ['DELEGATED_ACCESS'] },
pathMatch: 'full',
canActivate: [AuthGuard, RoleGuard],
component: DelegatedUserListComponent,
},
{
path: 'find-delegated-user',
data: { title: 'find-delegated-user' , roles: ['DELEGATED_ACCESS'] },
data: { title: 'Find a user' , roles: ['DELEGATED_ACCESS'] },
pathMatch: 'full',
canActivate: [AuthGuard, RoleGuard],
component: FindDelegatedUserComponent,
Expand Down Expand Up @@ -985,13 +992,13 @@ const routes: Routes = [
},
{
path: 'delegated-user-activation',
data: { title: 'deleagted-user-activation' },
data: { title: 'Delegated user activation' },
pathMatch: 'full',
component: DelegatedUserActivationComponent,
},
{
path: 'delegated-organisation',
data: { title: 'delegated-organisation'},
data: { title: 'Manage your delegated access'},
pathMatch: 'full',
canActivate: [AuthGuard],
component: DelegatedOrganisationComponent,
Expand Down
4 changes: 3 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ import { DelegatedErrorComponent } from './pages/manage-delegated/delegated-erro
import { DelegatedUserActivationComponent } from './pages/manage-delegated/landing-pages/delegated-user-activation/delegated-user-activation.component';
import { DelegatedOrganisationComponent } from './pages/manage-delegated/user/delegated-organisation/delegated-organisation.component';
import { TermsConditionsComponent } from './components/terms-conditions/terms-conditions.component';
import { ForgotPasswordErrorComponent } from './pages/forgot-password-error/forgot-password-error.component';

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
Expand Down Expand Up @@ -313,7 +314,8 @@ export function createTranslateLoader(http: HttpClient) {
DelegatedErrorComponent,
DelegatedUserActivationComponent,
DelegatedOrganisationComponent,
TermsConditionsComponent
TermsConditionsComponent,
ForgotPasswordErrorComponent
],
imports: [
// BrowserModule,
Expand Down
4 changes: 2 additions & 2 deletions src/app/interceptors/loading-indicator.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class LoadingIndicatorInterceptor implements HttpInterceptor {
}

intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if (this.urlExceptions.includes(req.url) || this.urlExceptions.includes(req.url.split('?')[0])) {
if (localStorage.getItem('show_loading_indicator') === 'false' && (this.urlExceptions.includes(req.url) || this.urlExceptions.includes(req.url.split('?')[0]))) {
this.loadingIndicatorService.isLoading.next(false);
}else{
this.requests.push(req);
Expand All @@ -60,4 +60,4 @@ export class LoadingIndicatorInterceptor implements HttpInterceptor {
};
});
}
}
}
24 changes: 17 additions & 7 deletions src/app/models/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export interface UserDetail {
title: string;
firstName: string;
lastName: string;
mfaEnabled : boolean;
isAdminUser : boolean;
mfaEnabled: boolean;
isAdminUser: boolean;
}

export interface UserRequestDetail {
Expand All @@ -33,15 +33,15 @@ export interface UserRequestDetail {
identityProviderIds?: number[];
}

export interface UserResponseDetail{
id : number,
export interface UserResponseDetail {
id: number,
userGroups?: UserGroup[];
canChangePassword: boolean;
rolePermissionInfo?: RolePermissionInfo[];
identityProviders?: UserIdentityProviderInfo[]
}

export interface UserIdentityProviderInfo{
export interface UserIdentityProviderInfo {
identityProviderId?: number;
identityProvider?: string;
identityProviderDisplayName?: string;
Expand All @@ -52,14 +52,14 @@ export interface RolePermissionInfo {
roleKey: string;
roleId: number,
serviceClientId: string;
serviceClientName : string;
serviceClientName: string;
}

export interface UserProfileRequestInfo extends UserDetail {
detail: UserRequestDetail
}

export interface UserProfileResponseInfo extends UserDetail {
export interface UserProfileResponseInfo extends UserDetail {
detail: UserResponseDetail
}

Expand All @@ -68,11 +68,21 @@ export interface UserListInfo {
userName: string;
}

export interface AdminUserListInfo extends UserListInfo {
role: string;
email: string;
}

export interface UserListResponse extends PaginationInfo {
organisationId: string;
userList: UserListInfo[];
}

export interface AdminUserListResponse extends PaginationInfo {
organisationId: string;
userList: AdminUserListInfo[];
}

export interface UserEditResponseInfo {
userId: string;
isRegisteredInIdam: boolean;
Expand Down
10 changes: 5 additions & 5 deletions src/app/pages/contact-admin/contact-admin.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ <h1 class="govuk-heading-xl page-title">
<div class="govuk-grid-row">
<div class="govuk-grid-column-full">
<div class="user-table">
<app-govuk-table [headerTextKeys]="usersTableHeaders" [data]="userList.userList"
[dataKeys]="usersColumnsToDisplay" [isHyperLinkVisible]="true"
[pageName]="pageName"
(hyperLinkClickEvent)="openEmailWindow($event)" [useServerPagination]="true" [serverPageCount]="pageCount"
[serverPageCurrentPage]="currentPage" (changeCurrentPageEvent)="setPage($event)"></app-govuk-table>
<app-govuk-table [headerTextKeys]="usersTableHeaders" [data]="userListResponse.userList"
[dataKeys]="usersColumnsToDisplay" [isHyperLinkVisible]="true" [pageName]="pageName"
(hyperLinkClickEvent)="openEmailWindow($event)" [useServerPagination]="true"
[serverPageCount]="pageCount" [serverPageCurrentPage]="currentPage"
(changeCurrentPageEvent)="setPage($event)"></app-govuk-table>
</div>
</div>
</div>
Expand Down
34 changes: 19 additions & 15 deletions src/app/pages/contact-admin/contact-admin.component.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { UserListResponse } from 'src/app/models/user';
import { AdminUserListResponse, UserListResponse } from 'src/app/models/user';
import { WrapperOrganisationGroupService } from 'src/app/services/wrapper/wrapper-org--group-service';
import { environment } from 'src/environments/environment';

Expand All @@ -10,33 +10,33 @@ import { environment } from 'src/environments/environment';
})
export class ContactAdminComponent implements OnInit {
private organisationId: string = '';
usersTableHeaders = ['Name','', 'Email address','Role'];
usersColumnsToDisplay = ['firstName', 'lastName','email','role'];
usersTableHeaders = ['Name', 'Email address', 'Role'];
usersColumnsToDisplay = ['name', 'email', 'role'];
currentPage: number = 1;
pageCount: number = 0;
pageSize: number = environment.listPageSize;
userList: UserListResponse;
pageName='Contactadmin';
userListResponse: AdminUserListResponse;
pageName = 'Contactadmin';

constructor(
private WrapperOrganisationGroupService: WrapperOrganisationGroupService
) {
this.organisationId = localStorage.getItem('cii_organisation_id') || '';
this.userList = {
this.userListResponse = {
currentPage: this.currentPage,
pageCount: 0,
rowCount: 0,
organisationId: this.organisationId,
userList: []
}
}
}

ngOnInit(): void {
this.getOrganisationUsers();
}

public openEmailWindow(data: any): void {
let AdminEmail = 'mailto:' + data.email;
let AdminEmail = 'mailto:' + data.userName;
window.location.href = AdminEmail;
}

Expand All @@ -46,21 +46,25 @@ export class ContactAdminComponent implements OnInit {
this.currentPage,
this.pageSize
).subscribe({
next: (userListResponse: any) => {
if (userListResponse != null) {
this.userList = userListResponse;
this.userList.userList = userListResponse.adminUserList;
this.pageCount = this.userList.pageCount;
next: (response: any) => {
if (response != null) {
this.userListResponse = response;
this.userListResponse.userList.forEach(x => {
x.role = 'Admin';
x.email = x.userName; // the common component expect the field as email
});

this.pageCount = this.userListResponse.pageCount;
}
},
error: (error: any) => {},
error: (error: any) => { },
});
}

setPage(pageNumber: any) {
this.currentPage = pageNumber;
this.getOrganisationUsers();
}
}
goBack() {
window.history.back();
}
Expand Down
Loading

0 comments on commit 271cf83

Please sign in to comment.