aboutsummaryrefslogtreecommitdiffstats
path: root/src/app
diff options
context:
space:
mode:
Diffstat (limited to 'src/app')
-rw-r--r--src/app/admin/admin.component.ts14
-rw-r--r--src/app/admin/view-edit/ansible-server.component.ts4
-rw-r--r--src/app/shared/components/navigation/navigation.component.spec.ts6
-rw-r--r--src/app/shared/components/navigation/navigation.component.ts12
-rw-r--r--src/app/shared/services/httpUtil/http-util.service.ts25
-rw-r--r--src/app/shared/services/utilityService/utility.service.ts12
-rw-r--r--src/app/test/test.component.ts10
-rw-r--r--src/app/vnfs/GCAuthGuard/gcauth.guard.spec.ts4
-rw-r--r--src/app/vnfs/LoginGuardService/Login-guard-service.ts6
-rw-r--r--src/app/vnfs/LoginGuardService/LoginGuardService.spec.ts4
-rw-r--r--src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.ts8
-rw-r--r--src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts6
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts4
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts8
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts6
-rw-r--r--src/app/vnfs/myvnfs/myvnfs.component.ts10
-rw-r--r--src/app/vnfs/userlogin-form/userlogin-form.component.html8
-rw-r--r--src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts6
-rw-r--r--src/app/vnfs/userlogin-form/userlogin-form.component.ts89
19 files changed, 73 insertions, 169 deletions
diff --git a/src/app/admin/admin.component.ts b/src/app/admin/admin.component.ts
index 4bde5b5..74fe86a 100644
--- a/src/app/admin/admin.component.ts
+++ b/src/app/admin/admin.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -70,8 +70,8 @@ export class AdminComponent implements OnInit {
}
ngOnInit() {
- const apiToken = sessionStorage['apiToken'];
- this.currentUser = sessionStorage['userId'];
+ const apiToken = localStorage['apiToken'];
+ this.currentUser = localStorage['userId'];
if(this.paramShareService.ansibleServerData) {
this.ansibleServerData = this.paramShareService.ansibleServerData;
@@ -92,14 +92,14 @@ export class AdminComponent implements OnInit {
const input = {
"input":{
"design-request":{
- "request-id":sessionStorage['apiToken'],
+ "request-id":localStorage['apiToken'],
"action":"getArtifact",
"payload":"{\"vnf-type\":\"NULL\",\"vnfc-type\":\"NULL\",\"protocol\":\"\",\"incart\":\"N\",\"action\":\"NULL\",\"artifact-name\":\""+this.fileName+"\",\"artifact-type\":\"APPC-CONFIG\",\"userID\":\"admin\"}"
}
}
};
//const x = JSON.parse(data.input['design-request']['payload']);
- //x.userID = sessionStorage['userId'];
+ //x.userID = localStorage['userId'];
//data.input['design-request']['payload'] = JSON.stringify(x);
console.log("input to payload====", JSON.stringify(input));
@@ -215,7 +215,7 @@ export class AdminComponent implements OnInit {
let input = {
"input": {
"design-request": {
- "request-id": sessionStorage['apiToken'],
+ "request-id": localStorage['apiToken'],
"action": "uploadAdminArtifact",
"payload": "{\"userID\": \"admin\",\"vnf-type\" : \"NULL \",\"action\" : \"NULL\",\"artifact-name\" : \""+this.fileName+"\",\"artifact-type\" : \"APPC-CONFIG\",\"artifact-version\" : \"0.1\",\"artifact-contents\":\""+artifactContent+"\"}",
}
@@ -244,4 +244,4 @@ export class AdminComponent implements OnInit {
}
}
-}
+} \ No newline at end of file
diff --git a/src/app/admin/view-edit/ansible-server.component.ts b/src/app/admin/view-edit/ansible-server.component.ts
index 6691092..b629b65 100644
--- a/src/app/admin/view-edit/ansible-server.component.ts
+++ b/src/app/admin/view-edit/ansible-server.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -78,7 +78,7 @@ export class AnsibleServerComponent implements OnInit {
}
ngOnInit() {
- this.currentUser = sessionStorage['userId'];
+ this.currentUser = localStorage['userId'];
this.item = JSON.parse(sessionStorage.getItem("ansibleserver"));
this.updateIndex = parseInt(sessionStorage.getItem("updateIndex"));
console.log("index===>"+this.updateIndex);
diff --git a/src/app/shared/components/navigation/navigation.component.spec.ts b/src/app/shared/components/navigation/navigation.component.spec.ts
index ead4b78..2d4aafe 100644
--- a/src/app/shared/components/navigation/navigation.component.spec.ts
+++ b/src/app/shared/components/navigation/navigation.component.spec.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -91,7 +91,7 @@ describe('NavigationComponent', () => {
it('should go to /vnfs/list if url = vnfs and userId is not null or undefined', inject([Router],(router: Router) => {
let navigateSpy = spyOn(router, 'navigate');
- sessionStorage['userId'] = 'testingId';
+ localStorage['userId'] = 'testingId';
let testUrl = 'vnfs';
component.gotoDetail(testUrl);
@@ -99,7 +99,7 @@ describe('NavigationComponent', () => {
it('should go to /vnfs if url = vnfs and userId is null or undefined', inject([Router],(router: Router) => {
let navigateSpy = spyOn(router, 'navigate');
- sessionStorage['userId'] = '';
+ localStorage['userId'] = '';
let testUrl = 'vnfs';
component.gotoDetail(testUrl);
diff --git a/src/app/shared/components/navigation/navigation.component.ts b/src/app/shared/components/navigation/navigation.component.ts
index 424a002..7271bb1 100644
--- a/src/app/shared/components/navigation/navigation.component.ts
+++ b/src/app/shared/components/navigation/navigation.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
===================================================================
@@ -36,7 +36,7 @@ export class NavigationComponent implements OnInit {
//@ViewChild(GoldenConfigurationComponent) goldenConfig: GoldenConfigurationComponent;
@Input() id: string;
userLoggedIn = false;
- userId: string = sessionStorage['userId'];
+ userId: string = localStorage['userId'];
subscription: Subscription;
constructor(private router: Router) {
@@ -49,7 +49,7 @@ export class NavigationComponent implements OnInit {
if (value != null && value != '' && value != undefined && value != 'undefined') {
this.userId = value;
this.userLoggedIn = true;
- sessionStorage['userId'] = this.userId;
+ localStorage['userId'] = this.userId;
} else {
this.logout();
}
@@ -58,7 +58,7 @@ export class NavigationComponent implements OnInit {
}
ngOnInit() {
- this.userId = sessionStorage['userId'];
+ this.userId = localStorage['userId'];
if (this.userId != undefined && this.userId != '') {
this.userLoggedIn = true;
}
@@ -99,7 +99,7 @@ export class NavigationComponent implements OnInit {
gotoDetail(url) {
if (url == 'vnfs') {
- if (sessionStorage['userId'] != undefined && sessionStorage['userId'] != '' && sessionStorage['userId'] != null) {
+ if (localStorage['userId'] != undefined && localStorage['userId'] != '' && localStorage['userId'] != null) {
this.router.navigate(['/vnfs/list']);
} else {
this.router.navigate(url);
@@ -122,4 +122,4 @@ export class NavigationComponent implements OnInit {
}
-}
+} \ No newline at end of file
diff --git a/src/app/shared/services/httpUtil/http-util.service.ts b/src/app/shared/services/httpUtil/http-util.service.ts
index 40c1518..fc9c327 100644
--- a/src/app/shared/services/httpUtil/http-util.service.ts
+++ b/src/app/shared/services/httpUtil/http-util.service.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -54,28 +54,5 @@ export class HttpUtilService {
.post(req.url, req.data, this.options)
.map((res: Response) => res.json())
}
-
- postWithAuth(req) {
- var authString = sessionStorage['auth'];
- if(authString === undefined || authString === null || authString.length === 0){
- this.options = new RequestOptions({
- headers: new Headers({
- 'Content-Type': 'application/json'
- })
- });
- } else {
- this.options = new RequestOptions({
- headers: new Headers({
- 'Content-Type': 'application/json',
- 'Authorization': 'Basic ' + authString
- })
- });
- }
-
- return this
- .http
- .post(req.url, req.data, this.options)
- .map((res: Response) => res.json())
- }
}
diff --git a/src/app/shared/services/utilityService/utility.service.ts b/src/app/shared/services/utilityService/utility.service.ts
index 54ea76b..6b29a2e 100644
--- a/src/app/shared/services/utilityService/utility.service.ts
+++ b/src/app/shared/services/utilityService/utility.service.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Copyright (C) 2018 IBM.
===================================================================
@@ -131,8 +131,8 @@ export class UtilityService {
public createPayLoadForSave(artifactType,vnfType,action,fileName, versionNo, artifactContent)
{
- let userId=sessionStorage['userId'];
- let apiToken=sessionStorage['apiToken']
+ let userId=localStorage['userId'];
+ let apiToken=localStorage['apiToken']
let newPayload:any;
switch(artifactType)
{
@@ -187,14 +187,14 @@ export class UtilityService {
let payload:any;
if(isReference) {
payload=JSON.parse(sessionStorage.getItem('updateParams'));
- payload['userID'] = sessionStorage['userId'];
+ payload['userID'] = localStorage['userId'];
payload = JSON.stringify(payload);
}
- else payload = '{"userID": "' + sessionStorage['userId'] + '","action": "' + action + '", "vnf-type" : "' + vnfType + '", "artifact-type":"APPC-CONFIG", "artifact-name":"' + fileName + '"}';
+ else payload = '{"userID": "' + localStorage['userId'] + '","action": "' + action + '", "vnf-type" : "' + vnfType + '", "artifact-type":"APPC-CONFIG", "artifact-name":"' + fileName + '"}';
let data = {
'input': {
'design-request': {
- 'request-id': sessionStorage['apiToken'],
+ 'request-id': localStorage['apiToken'],
'action': 'getArtifact',
'payload': payload
}
diff --git a/src/app/test/test.component.ts b/src/app/test/test.component.ts
index d1dd0c4..347bde6 100644
--- a/src/app/test/test.component.ts
+++ b/src/app/test/test.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Copyright (C) 2018 IBM.
===================================================================
@@ -102,7 +102,7 @@ export class TestComponent implements OnInit {
public pollCounter = 0;
public enableCounterDiv: boolean = false;
public enableDownload: boolean = false;
- private userId = sessionStorage['userId'];
+ private userId = localStorage['userId'];
timeStampInt: number;
AppcTimeStampInt: number;
AppcTimeDiff: number;
@@ -395,7 +395,7 @@ export class TestComponent implements OnInit {
this.ngProgress.start();
this.apiRequest = JSON.stringify(this.constructRequest());
- this.httpUtil.postWithAuth(
+ this.httpUtil.post(
{
url: environment.testVnf + "?urlAction=" + this.getUrlEndPoint(this.action),
data: this.apiRequest
@@ -440,7 +440,7 @@ export class TestComponent implements OnInit {
}
};
console.log('getAppcTimestamp: sending httpUtil.post...');
- this.httpUtil.postWithAuth(
+ this.httpUtil.post(
{
url: environment.getDesigns, data: data
})
@@ -536,7 +536,7 @@ export class TestComponent implements OnInit {
'payload': '{"request-id":' + this.requestId + '}'
}
};
- this.httpUtil.postWithAuth(
+ this.httpUtil.post(
{
url: environment.checkTestStatus, data: data
diff --git a/src/app/vnfs/GCAuthGuard/gcauth.guard.spec.ts b/src/app/vnfs/GCAuthGuard/gcauth.guard.spec.ts
index 216a4df..440993d 100644
--- a/src/app/vnfs/GCAuthGuard/gcauth.guard.spec.ts
+++ b/src/app/vnfs/GCAuthGuard/gcauth.guard.spec.ts
@@ -51,7 +51,7 @@ describe('LogginGuard', () => {
});
it('be able to return true when referenceNameObjects is defined', inject([GCAuthGuardService, MappingEditorService], (service: GCAuthGuardService, mapService: MappingEditorService) => {
- sessionStorage['userId'] = 'abc@xyz.com';
+ localStorage['userId'] = 'abc@xyz.com';
mapService.referenceNameObjects = { data : 'data'};
let route : ActivatedRouteSnapshot;
let state: RouterStateSnapshot;
@@ -61,7 +61,7 @@ describe('LogginGuard', () => {
}));
it('stop routing if referenceNameObjects is not defined', inject([GCAuthGuardService, MappingEditorService, NgbModal], (service: GCAuthGuardService, mapService: MappingEditorService, ngbModal: NgbModal) => {
- sessionStorage['userId'] = 'abc@xyz.com';
+ localStorage['userId'] = 'abc@xyz.com';
mapService.referenceNameObjects = undefined;
let spy = spyOn(NgbModal.prototype, 'open').and.returnValue(Promise.resolve(true));
let route : ActivatedRouteSnapshot;
diff --git a/src/app/vnfs/LoginGuardService/Login-guard-service.ts b/src/app/vnfs/LoginGuardService/Login-guard-service.ts
index 1938030..1e7e752 100644
--- a/src/app/vnfs/LoginGuardService/Login-guard-service.ts
+++ b/src/app/vnfs/LoginGuardService/Login-guard-service.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
Copyright (C) 2018 IBM.
===================================================================
@@ -35,7 +35,7 @@ export class LoginGuardService implements CanActivate {
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
- let userId = sessionStorage['userId'];
+ let userId = localStorage['userId'];
if (userId != null && userId != undefined && userId != '') {
return true;
} else {
@@ -44,4 +44,4 @@ export class LoginGuardService implements CanActivate {
}
}
-}
+} \ No newline at end of file
diff --git a/src/app/vnfs/LoginGuardService/LoginGuardService.spec.ts b/src/app/vnfs/LoginGuardService/LoginGuardService.spec.ts
index a2e26b8..1c57478 100644
--- a/src/app/vnfs/LoginGuardService/LoginGuardService.spec.ts
+++ b/src/app/vnfs/LoginGuardService/LoginGuardService.spec.ts
@@ -51,14 +51,14 @@ describe('LogginGuard', () => {
});
it('be able to hit route when user is logged in', inject([LoginGuardService], (service: LoginGuardService) => {
- sessionStorage['userId'] = 'abc@xyz.com';
+ localStorage['userId'] = 'abc@xyz.com';
let route : ActivatedRouteSnapshot;
let state: RouterStateSnapshot;
expect(service.canActivate(route, state)).toBe(true);
}));
it('be able to navigate to login page when user is not logged in', inject([LoginGuardService], (service: LoginGuardService) => {
- sessionStorage['userId'] = '';
+ localStorage['userId'] = '';
let route : ActivatedRouteSnapshot;
let mockSnapshot:any = jasmine.createSpyObj<RouterStateSnapshot>("RouterStateSnapshot", ['toString']);
expect(service.canActivate(route, mockSnapshot)).toBe(false);
diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.ts
index add5b5e..ae4aec4 100644
--- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.ts
+++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
Copyright (C) 2018 IBM.
===================================================================
@@ -63,8 +63,8 @@ export class ParameterDefinitionService {
public myKeyFileName = null;
public myPdFileName = null;
private selectedActionReference: any;
- private apiToken = sessionStorage['apiToken'];
- private userId = sessionStorage['userId'];
+ private apiToken = localStorage['apiToken'];
+ private userId = localStorage['userId'];
public versionNoForApiCall=require('../../../../cdt.application.properties.json').versionNoForApiCall;
constructor(private mappingEditorService: MappingEditorService,
@@ -556,4 +556,4 @@ export class ParameterDefinitionService {
this.populatePD(fileModel);
return this.displayParamObjects;
}
-}
+} \ No newline at end of file
diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
index 7686839..64f1159 100644
--- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
+++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
===================================================================
@@ -72,8 +72,8 @@ export class ParameterComponent implements OnInit {
public confirmation: boolean;
public showConfirmation: boolean;
public test: boolean;
- apiToken = sessionStorage['apiToken'];
- userId = sessionStorage['userId'];
+ apiToken = localStorage['apiToken'];
+ userId = localStorage['userId'];
public initialData: any;
public intialData: any;
public initialAction: any;
diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
index ac89a2d..a3ef4f7 100644
--- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
+++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -939,7 +939,7 @@ export class ReferenceDataformComponent implements OnInit {
let payload = this.utilityService.createPayLoadForSave("reference_data", dataJson['scope']['vnf-type'], "AllAction", fileName, this.versionNoForApiCall, slashedPayload);
this.ngProgress.start();
- this.httpUtils.postWithAuth({
+ this.httpUtils.post({
url: environment.getDesigns,
data: payload
}).subscribe((resp) => {
diff --git a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts
index ab1a7b3..f18fe6c 100644
--- a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Copyright (C) 2018 IBM Intellectual Property. All rights reserved.
===================================================================
@@ -77,8 +77,8 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
action: any = '';
artifactName: any = '';
enableMerge: boolean = false;
- apiToken = sessionStorage['apiToken'];
- userId = sessionStorage['userId'];
+ apiToken = localStorage['apiToken'];
+ userId = localStorage['userId'];
identifier: any;
public uploadTypes = [
@@ -435,4 +435,4 @@ export class GoldenConfigurationMappingComponent implements OnInit, OnDestroy {
}
}
-}
+} \ No newline at end of file
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
index 913e5e9..cee9629 100644
--- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -75,7 +75,7 @@ export class GoldenConfigurationComponent implements OnInit {
enableBrowse: boolean = true;
enableMerge: boolean = false;
uploadValidationSuccess: boolean = false;
- apiToken = sessionStorage['apiToken'];
+ apiToken = localStorage['apiToken'];
public appDataObject: any;
public downloadDataObject: any;
public checkNameEntered: boolean = true;
@@ -130,7 +130,7 @@ export class GoldenConfigurationComponent implements OnInit {
public fileType: any = '';
public actionType: any;
public myfileName: any;
- userId = sessionStorage['userId'];
+ userId = localStorage['userId'];
public artifactRequest: ArtifactRequest = new ArtifactRequest();
public showUploadStatus: boolean = false;
public uploadStatus: boolean = false;
diff --git a/src/app/vnfs/myvnfs/myvnfs.component.ts b/src/app/vnfs/myvnfs/myvnfs.component.ts
index 696e601..49f4f42 100644
--- a/src/app/vnfs/myvnfs/myvnfs.component.ts
+++ b/src/app/vnfs/myvnfs/myvnfs.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Copyright (C) 2018 IBM.
===================================================================
@@ -63,7 +63,7 @@ export class MyvnfsComponent implements OnInit, OnDestroy {
sessionStorage.setItem('updateParams', undefined);
this.mappingEditorService.latestAction = undefined;
- const apiToken = sessionStorage['apiToken'];
+ const apiToken = localStorage['apiToken'];
const data = {
'input': {
@@ -75,7 +75,7 @@ export class MyvnfsComponent implements OnInit, OnDestroy {
}
};
const x = JSON.parse(data.input['design-request']['payload']);
- x.userID = sessionStorage['userId'];
+ x.userID = localStorage['userId'];
data.input['design-request']['payload'] = JSON.stringify(x);
// console.log("input to payload====", JSON.stringify(data));
this.getArtifacts(data);
@@ -89,7 +89,7 @@ export class MyvnfsComponent implements OnInit, OnDestroy {
getArtifacts(data) {
let tempObj: any;
this.ngProgress.start();
- this.httpUtil.postWithAuth({
+ this.httpUtil.post({
url: environment.getDesigns,
data: data
})
@@ -233,4 +233,4 @@ export class MyvnfsComponent implements OnInit, OnDestroy {
}
-}
+} \ No newline at end of file
diff --git a/src/app/vnfs/userlogin-form/userlogin-form.component.html b/src/app/vnfs/userlogin-form/userlogin-form.component.html
index 069583e..3f18b72 100644
--- a/src/app/vnfs/userlogin-form/userlogin-form.component.html
+++ b/src/app/vnfs/userlogin-form/userlogin-form.component.html
@@ -1,7 +1,7 @@
<!--
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -32,10 +32,6 @@ limitations under the License.
[(ngModel)]="userId" name="userId" value="" #user="ngModel" (ngModelChange)="validateUserName()">
<span class="error-message">{{errorMessage}}</span>
</div>
- <div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
- <input type="password" placeholder="Enter password" class="mdl-textfield__input" id="password" required
- [(ngModel)]="password" name="password" value="" (ngModelChange)="validatePassword()" >
- </div>
<div class="form-group text-right">
<button type="submit" [disabled]="invalid"
@@ -47,4 +43,4 @@ limitations under the License.
</div>
</div>
</div>
-</div>
+</div> \ No newline at end of file
diff --git a/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts b/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts
index bf8431b..712d1bf 100644
--- a/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts
+++ b/src/app/vnfs/userlogin-form/userlogin-form.component.spec.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
Modification Copyright (C) 2018 IBM
===================================================================
@@ -64,7 +64,7 @@ describe('userloginFormComponent', () => {
fixture = TestBed.createComponent(userloginFormComponent);
component = fixture.componentInstance;
fixture.detectChanges();
- // sessionStorage['userId'] = "testUser"
+ // localStorage['userId'] = "testUser"
component.userId = 'test Usr';
});
@@ -99,7 +99,7 @@ describe('userloginFormComponent', () => {
expect(url.length).toBe(5);
expect(url[0]).toEqual('/');
expect(url[1]).toEqual('h');
- expect(sessionStorage['userId']).toBe('test Usr');
+ expect(localStorage['userId']).toBe('test Usr');
}));
it('test validateUserName function', () => {
diff --git a/src/app/vnfs/userlogin-form/userlogin-form.component.ts b/src/app/vnfs/userlogin-form/userlogin-form.component.ts
index 7ed087e..c62e9bb 100644
--- a/src/app/vnfs/userlogin-form/userlogin-form.component.ts
+++ b/src/app/vnfs/userlogin-form/userlogin-form.component.ts
@@ -1,7 +1,7 @@
/*
============LICENSE_START==========================================
===================================================================
-Copyright (C) 2018-2020 AT&T Intellectual Property. All rights reserved.
+Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
Unless otherwise specified, all software contained herein is licensed
@@ -23,24 +23,19 @@ import {Component, OnInit} from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import {EmitterService} from '../../shared/services/emitter.service';
-import { environment } from '../../../environments/environment';
-import { HttpUtilService } from '../../shared/services/httpUtil/http-util.service';
import {Router} from '@angular/router';
-import { NgProgress } from 'ngx-progressbar';
import {UtilityService} from '../../shared/services/utilityService/utility.service';
-import { Http, Response, Headers, RequestOptions } from '@angular/http';
@Component({selector: 'app-mvnfs-form', templateUrl: './userlogin-form.component.html', styleUrls: ['./userlogin-form.component.css']})
export class userloginFormComponent implements OnInit {
userId: string = '';
- password: string = '';
returnUrl:string
invalid = true;
errorMessage = '';
- constructor(private router: Router, private utiltiy: UtilityService, private route: ActivatedRoute,
- private http: Http, private ngProgress: NgProgress) {
+ constructor(private router: Router, private utiltiy: UtilityService, private route: ActivatedRoute
+ ) {
}
ngOnInit() {
@@ -49,57 +44,12 @@ export class userloginFormComponent implements OnInit {
getData() {
- this.ngProgress.start();
- var getHeader = new Headers({ 'Content-Type': 'application/json' }); // ... Set content type to JSON
- var authStr = btoa(this.userId + ':' + this.password);
- const options = {
- headers: new Headers({
- 'Content-Type': 'application/json',
- 'Authorization': 'Basic ' + authStr
- }),
- observe: 'response'
- };
- const data = {
- 'input': {
- 'design-request': {
- 'request-id': '1',
- 'action': 'getDesigns',
- 'payload': '{"userID": "","filter":"reference"}'
- }
- }
- };
- const x = JSON.parse(data.input['design-request']['payload']);
- x.userID = this.userId;
- data.input['design-request']['payload'] = JSON.stringify(x);
- console.log("auth " + btoa(this.userId + ':' + this.password));
- this.http.post(environment.getDesigns,data,options).subscribe(resp => {
- console.log("status " + resp.status);
- if(resp.status == 200){
- console.log('logged in');
- sessionStorage['userId'] = this.userId;
- sessionStorage['apiToken'] = this.utiltiy.randomId();
- sessionStorage['auth'] = authStr;
- EmitterService
- .get('userLogin')
- .emit(this.userId);
- this.router.navigateByUrl(this.returnUrl);
- } else {
- console.log("Invalid user or password");
- this.invalid = true;
- this.errorMessage = 'Invalid user or password';
- }
- }, error => {
- console.log(error);
- if(error.status == 401){
- this.invalid = true;
- this.errorMessage = 'Invalid user or password';
- } else {
- this.invalid = true;
- this.errorMessage = 'Incorrect login or connection error.';
- }
- });
- console.log("After");
-
+ localStorage['userId'] = this.userId;
+ localStorage['apiToken'] = this.utiltiy.randomId();
+ EmitterService
+ .get('userLogin')
+ .emit(this.userId);
+ this.router.navigateByUrl(this.returnUrl);
}
validateUserName(){
@@ -107,7 +57,7 @@ export class userloginFormComponent implements OnInit {
this.errorMessage = '';
this.invalid = true;
}else if(this.userId.startsWith(' ') || this.userId.endsWith(' ')){
- this.errorMessage = 'Leading and trailing space is not allowed in username';
+ this.errorMessage = 'Leading and trailing space is not allowed';
this.invalid = true;
} else if(this.userId.includes(' ')){
this.errorMessage = 'More than one space is not allowed in username';
@@ -120,24 +70,5 @@ export class userloginFormComponent implements OnInit {
this.errorMessage = '';
}
}
-
- validatePassword(){
- if (!this.password.trim() || this.password.length < 1) {
- this.errorMessage = '';
- this.invalid = true;
- }else if(this.password.startsWith(' ') || this.password.endsWith(' ')){
- this.errorMessage = 'Leading and trailing space is not allowed in password';
- this.invalid = true;
- } else if(this.password.includes(' ')){
- this.errorMessage = 'More than one space is not allowed in password';
- this.invalid = true;
- } else if(this.password.length > 50) {
- this.errorMessage = 'Password should be of minimum one character and maximum 50 character';
- this.invalid = true;
- }else {
- this.invalid = false;
- this.errorMessage = '';
- }
- }
}