From 2f526e2b5f16689adcd0ee520d8c4b318449f122 Mon Sep 17 00:00:00 2001 From: kunw Date: Wed, 3 May 2017 16:03:27 +0800 Subject: [PATCH 1/2] Encode sign-in params. --- src/ui_ng/src/app/shared/session.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui_ng/src/app/shared/session.service.ts b/src/ui_ng/src/app/shared/session.service.ts index 75490bbe7..a3c18904c 100644 --- a/src/ui_ng/src/app/shared/session.service.ts +++ b/src/ui_ng/src/app/shared/session.service.ts @@ -73,7 +73,7 @@ export class SessionService { body.set('password', signInCredential.password); //Trigger Http - return this.http.post(signInUrl, body.toString(), { headers: this.formHeaders }) + return this.http.post(signInUrl, encodeURIComponent(body.toString()), { headers: this.formHeaders }) .toPromise() .then(() => null) .catch(error => this.handleError(error)); From e5a17418c85957b2558f12560174027af43586e3 Mon Sep 17 00:00:00 2001 From: kunw Date: Wed, 3 May 2017 18:32:48 +0800 Subject: [PATCH 2/2] Fix sign-in encode issue. --- src/ui_ng/src/app/shared/session.service.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/ui_ng/src/app/shared/session.service.ts b/src/ui_ng/src/app/shared/session.service.ts index a3c18904c..bc0fea7a1 100644 --- a/src/ui_ng/src/app/shared/session.service.ts +++ b/src/ui_ng/src/app/shared/session.service.ts @@ -68,12 +68,11 @@ export class SessionService { //Submit signin form to backend (NOT restful service) signIn(signInCredential: SignInCredential): Promise { //Build the form package - const body = new URLSearchParams(); - body.set('principal', signInCredential.principal); - body.set('password', signInCredential.password); + let queryParam:string = 'principal=' + encodeURIComponent(signInCredential.principal) + + '&password=' + encodeURIComponent(signInCredential.password); //Trigger Http - return this.http.post(signInUrl, encodeURIComponent(body.toString()), { headers: this.formHeaders }) + return this.http.post(signInUrl, queryParam, { headers: this.formHeaders }) .toPromise() .then(() => null) .catch(error => this.handleError(error));