From bf9ae5ce57c9e2117548ab5794c0c2a5096ba4ad Mon Sep 17 00:00:00 2001
From: Chocobozzz <me@florianbigard.com>
Date: Mon, 26 Mar 2018 11:49:44 +0200
Subject: Fix log in with special password character (+)

---
 client/src/app/core/auth/auth.service.ts | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

(limited to 'client/src/app')

diff --git a/client/src/app/core/auth/auth.service.ts b/client/src/app/core/auth/auth.service.ts
index 8700e8c74..f5ca2fcdc 100644
--- a/client/src/app/core/auth/auth.service.ts
+++ b/client/src/app/core/auth/auth.service.ts
@@ -112,17 +112,17 @@ export class AuthService {
 
   login (username: string, password: string) {
     // Form url encoded
-    const body = new HttpParams().set('client_id', this.clientId)
-                                 .set('client_secret', this.clientSecret)
-                                 .set('response_type', 'code')
-                                 .set('grant_type', 'password')
-                                 .set('scope', 'upload')
-                                 .set('username', username)
-                                 .set('password', password)
+    const body = new URLSearchParams()
+    body.set('client_id', this.clientId)
+    body.set('client_secret', this.clientSecret)
+    body.set('response_type', 'code')
+    body.set('grant_type', 'password')
+    body.set('scope', 'upload')
+    body.set('username', username)
+    body.set('password', password)
 
     const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
-
-    return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, body, { headers })
+    return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, body.toString(), { headers })
                     .map(res => Object.assign(res, { username }))
                     .flatMap(res => this.mergeUserInformation(res))
                     .map(res => this.handleLogin(res))
-- 
cgit v1.2.3