Properly encode credentials
This commit is contained in:
parent
18bd75ca4f
commit
a6ddda38ae
|
@ -62,7 +62,7 @@ export default class LoginFormUiHandler extends FormModalUiHandler {
|
|||
const headers = {
|
||||
'Content-Type': contentType,
|
||||
};
|
||||
fetch(`${Utils.apiUrl}/account/login`, { method: 'POST', headers: headers, body: `username=${this.inputs[0].text}&password=${this.inputs[1].text}` })
|
||||
fetch(`${Utils.apiUrl}/account/login`, { method: 'POST', headers: headers, body: `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}` })
|
||||
.then(response => {
|
||||
if (!response.ok)
|
||||
return response.text();
|
||||
|
|
|
@ -77,11 +77,11 @@ export default class RegistrationFormUiHandler extends FormModalUiHandler {
|
|||
const headers = {
|
||||
'Content-Type': contentType,
|
||||
};
|
||||
fetch(`${Utils.apiUrl}/account/register`, { method: 'POST', headers: headers, body: `username=${this.inputs[0].text}&password=${this.inputs[1].text}` })
|
||||
fetch(`${Utils.apiUrl}/account/register`, { method: 'POST', headers: headers, body: `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}` })
|
||||
.then(response => response.text())
|
||||
.then(response => {
|
||||
if (!response) {
|
||||
fetch(`${Utils.apiUrl}/account/login`, { method: 'POST', headers: headers, body: `username=${this.inputs[0].text}&password=${this.inputs[1].text}` })
|
||||
fetch(`${Utils.apiUrl}/account/login`, { method: 'POST', headers: headers, body: `username=${encodeURIComponent(this.inputs[0].text)}&password=${encodeURIComponent(this.inputs[1].text)}` })
|
||||
.then(response => {
|
||||
if (!response.ok)
|
||||
return response.text();
|
||||
|
|
Loading…
Reference in New Issue