Merge pull request #1558 from ansible/jlmitch5-patch-2

encode username and password when sending login POST from ui
This commit is contained in:
John Mitchell 2018-03-14 11:29:34 -04:00 committed by GitHub
commit 5eed816c4d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,11 +49,10 @@ export default
return getCSRFToken.then(function({data}) {
var csrfmiddlewaretoken = /name='csrfmiddlewaretoken' value='([0-9a-zA-Z]+)' \//.exec(data)[1];
// TODO: data needs to be encoded
return $http({
method: 'POST',
url: `/api/login/`,
data: `username=${username}&password=${password}&csrfmiddlewaretoken=${csrfmiddlewaretoken}&next=%2fapi%2f`,
data: `username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}&csrfmiddlewaretoken=${csrfmiddlewaretoken}&next=%2fapi%2f`,
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}