Skip to content

Instantly share code, notes, and snippets.

@abnersajr
Last active December 19, 2022 15:34
Show Gist options
  • Save abnersajr/fb197c23ce18e3c406824276a687850b to your computer and use it in GitHub Desktop.
Save abnersajr/fb197c23ce18e3c406824276a687850b to your computer and use it in GitHub Desktop.
batch-password-change
function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
}
const get_emails = Array.from(
document.querySelectorAll("[id^='account-name_']")
).map((item) => item.innerText);
const process_buttons = (emails) => {
const email = emails.pop();
document
.querySelector(`button[id='email_table_disk_and_quota_${email}']`)
.click();
sleep(1800)
.then(() => {
$("#txtEmailPassword").val("migrate1020").change();
})
.then(() => sleep(400))
.then(() => {
document.getElementById("btnUpdateEmailEmailAccount").click();
})
.then(() => sleep(1800))
.then(() => {
if (emails.length > 0) {
process_buttons(emails);
}
});
};
process_buttons(get_emails);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment