Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add password update flows #176

Merged
merged 2 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions autofill/password-update.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Password update flows</title>
<link rel="stylesheet" href="./style.css" />
</head>

<body>

<p><a href="../index.html">[Home]</a></p>

<div class="dialog">
<form action="/change-password" id="change">
<h2>Change password (with hidden username field)</h2>
<fieldset>
<input id="email" type="hidden" value="test@test.com">
<label for="password-current">Current Password</label>
<input id="password-current" name="password-current" type="password" autocomplete="current-password">
<label for="password-new">New Password</label>
<input id="password-new" name="password-new" type="password" autocomplete="new-password">
<label for="password-new-confirm">Confirm Password</label>
<input id="password-new-confirm" name="password-new-confirm" type="password" autocomplete="new-password">
<button type="submit">Change password</button>
</fieldset>
</form>
<hr />
<form action="/change-password" id="change-no-user">
<h2>Change password (without username)</h2>
<fieldset>
<label for="password-current-no-user">Current Password</label>
<input id="password-current-no-user" name="password-current" type="password" autocomplete="current-password">
<label for="password-new-no-user">New Password</label>
<input id="password-new-no-user" name="password-new" type="password" autocomplete="new-password">
<label for="password-new-confirm-no-user">Confirm Password</label>
<input id="password-new-confirm-no-user" name="password-new-confirm" type="password" autocomplete="new-password">
<button type="submit">Change password</button>
</fieldset>
</form>
<hr />
<form action="/change-password" id="change-2">
<h2>Change password (without current password)</h2>
<fieldset>
<label for="password-new-2">New Password</label>
<input id="password-new-2" name="password-new-2" type="password" autocomplete="new-password">
<label for="password-new-confirm-2">Confirm Password</label>
<input id="password-new-confirm-2" name="password-new-confirm-2" type="password" autocomplete="new-password">
<button type="submit">Change password</button>
</fieldset>
</form>
<hr />
<form action="/change-password" id="change-3">
<h2>Change password (without autocomplete attributes)</h2>
<fieldset>
<label for="password-current-3">Current Password</label>
<input id="password-current-3" name="password-current-3" type="password">
<label for="password-new-3">New Password</label>
<input id="password-new-3" name="password-new-3" type="password">
<label for="password-new-confirm-3">Confirm Password</label>
<input id="password-new-confirm-3" name="password-new-confirm-3" type="password">
<button type="submit">Save changes</button>
</fieldset>
</form>
</div>
<script type="module">
[...document.forms].forEach((form) => {
form.addEventListener('submit', (e) => {
e.preventDefault();
const formData = new FormData(e.target);
const dl = document.createElement('dl');
formData.forEach((value, key) => {
const dt = document.createElement('dt');
const dd = document.createElement('dd');
dt.innerText = key;
dd.innerText = value;
dl.append(dt, dd);
});
form.after(dl);
form.remove();
});
});
</script>
</body>

</html>
20 changes: 19 additions & 1 deletion autofill/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,10 @@ hr {

fieldset {
display: grid;
grid-template-columns: max-content minmax(80px, 1fr);
grid-template-columns: 1fr 1fr;
grid-gap: 1em;
width: 410px;
max-width: 100%;
max-width: 100%;
padding: 0;
border: none;
Expand Down Expand Up @@ -117,3 +119,19 @@ button,
align-items: center;
z-index: 1000;
}

dl {
text-align: left;
width: 80%;
margin-left: auto;
margin-right: auto;
}

dt {
font-weight: bold;
margin-top: 1em;
}

dt::after {
content: ':'
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ <h2>Autofill</h2>
<li><a href="./autofill/form-submission.html">Form submission detection and autofill</a></li>
<li><a href="./autofill/frame-form-submission-parent.html">Form submission detection and autofill within an iframe</a></li>
<li><a href="./autofill/signup.html">Password generation during signup</a></li>
<li><a href="./autofill/password-update.html">Password update/reset forms</a></li>
<li>
Autoprompt credentials autofill when a login form is front and center
<ul>
Expand Down
Loading