boundless-hydrogen-45841
11/10/2021, 9:05 AMproud-plumber-24205
11/10/2021, 10:11 AMboundless-hydrogen-45841
11/10/2021, 10:29 AMconst changePassword = (values) => {
// values is the content i.e. password
// ui is the response for settings flow
var updatePasswordForm = document.createElement('form');
updatePasswordForm.action = ui.action;
updatePasswordForm.method = ui.method;
updatePasswordForm.style.display = 'none';
var passwordInput = document.createElement('input');
passwordInput.name = 'password';
passwordInput.value = values.password;
var csrfInput = document.createElement('input');
csrfInput.name = 'csrf_token';
csrfInput.value = ui.nodes.find((value) => {
if (value.attributes.name === 'csrf_token') {
return value;
}
}).attributes.value;
var methodInput = document.createElement('input');
methodInput.name = 'method';
methodInput.value = 'password';
updatePasswordForm.appendChild(passwordInput);
updatePasswordForm.appendChild(methodInput);
updatePasswordForm.appendChild(csrfInput);
document.body.appendChild(updatePasswordForm);
updatePasswordForm.submit();
};
boundless-hydrogen-45841
11/10/2021, 10:48 AMproud-plumber-24205
11/10/2021, 10:56 AMboundless-hydrogen-45841
11/10/2021, 10:57 AM