<html>
<body>
<script>
function create_iframe(src, id, anonymous) {
return new Promise(resolve => {
let iframe = document.createElement("iframe");
iframe.credentialless = anonymous;
iframe.id = id;
iframe.src = src;
document.body.appendChild(iframe);
iframe.onload = resolve;
});
}
async function check_password(child) {
const element = child.getElementById('password');
return new Promise(async resolve => {
element.onchange = () => {
if (element.value) {
resolve(element.value);
}
};
element.onchange();
setTimeout(() => resolve("not found"), 1000);
});
}
function inject_form(child) {
let form = child.createElement('form');
form.method = "POST";
form.name = "TestForm";
form.action = "/password/done.html";
child.body.appendChild(form);
let username = child.createElement('input');
username.id = "username";
username.type = "text";
username.autocomplete = "username";
form.appendChild(username);
let input = child.createElement('input');
input.id = "password";
input.type = "password";
input.autocomplete = "password";
form.appendChild(input);
}
</script>
</body>
</html>