diff options
author | Chocobozzz <me@florianbigard.com> | 2018-03-26 11:49:44 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-03-26 11:49:44 +0200 |
commit | bf9ae5ce57c9e2117548ab5794c0c2a5096ba4ad (patch) | |
tree | 9e1e80f2681552df8813469cce231e1a9e370951 | |
parent | 53eb90c0ab584ee48774e15ee7c0e764cfe4559d (diff) | |
download | PeerTube-bf9ae5ce57c9e2117548ab5794c0c2a5096ba4ad.tar.gz PeerTube-bf9ae5ce57c9e2117548ab5794c0c2a5096ba4ad.tar.zst PeerTube-bf9ae5ce57c9e2117548ab5794c0c2a5096ba4ad.zip |
Fix log in with special password character (+)
-rw-r--r-- | client/src/app/core/auth/auth.service.ts | 18 | ||||
-rw-r--r-- | server.ts | 2 |
2 files changed, 10 insertions, 10 deletions
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 { | |||
112 | 112 | ||
113 | login (username: string, password: string) { | 113 | login (username: string, password: string) { |
114 | // Form url encoded | 114 | // Form url encoded |
115 | const body = new HttpParams().set('client_id', this.clientId) | 115 | const body = new URLSearchParams() |
116 | .set('client_secret', this.clientSecret) | 116 | body.set('client_id', this.clientId) |
117 | .set('response_type', 'code') | 117 | body.set('client_secret', this.clientSecret) |
118 | .set('grant_type', 'password') | 118 | body.set('response_type', 'code') |
119 | .set('scope', 'upload') | 119 | body.set('grant_type', 'password') |
120 | .set('username', username) | 120 | body.set('scope', 'upload') |
121 | .set('password', password) | 121 | body.set('username', username) |
122 | body.set('password', password) | ||
122 | 123 | ||
123 | const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') | 124 | const headers = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded') |
124 | 125 | return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, body.toString(), { headers }) | |
125 | return this.http.post<UserLogin>(AuthService.BASE_TOKEN_URL, body, { headers }) | ||
126 | .map(res => Object.assign(res, { username })) | 126 | .map(res => Object.assign(res, { username })) |
127 | .flatMap(res => this.mergeUserInformation(res)) | 127 | .flatMap(res => this.mergeUserInformation(res)) |
128 | .map(res => this.handleLogin(res)) | 128 | .map(res => this.handleLogin(res)) |
@@ -88,11 +88,11 @@ app.use(morgan('combined', { | |||
88 | stream: { write: logger.info.bind(logger) } | 88 | stream: { write: logger.info.bind(logger) } |
89 | })) | 89 | })) |
90 | // For body requests | 90 | // For body requests |
91 | app.use(bodyParser.urlencoded({ extended: false })) | ||
91 | app.use(bodyParser.json({ | 92 | app.use(bodyParser.json({ |
92 | type: [ 'application/json', 'application/*+json' ], | 93 | type: [ 'application/json', 'application/*+json' ], |
93 | limit: '500kb' | 94 | limit: '500kb' |
94 | })) | 95 | })) |
95 | app.use(bodyParser.urlencoded({ extended: false })) | ||
96 | 96 | ||
97 | // ----------- Tracker ----------- | 97 | // ----------- Tracker ----------- |
98 | 98 | ||