// Listen for the "changePassword" event.
instance.on('changePassword', function() {
// Get the current form submission.
var submission = instance.submission;
// Get the current user object.
var user = Formio.getUser();
// Set the user password to the form password value.
user.data.password = submission.data.password;
(new Formio(Formio.getProjectUrl() + '/user/submission')).saveSubmission(user).then(function() {
var projectName = (new Formio(Formio.getProjectUrl())).projectId;
// Redirect to a thank you page.
window.location.href = 'https://pro.formview.io/#/' + projectName + '/thanks?reset=true';