Skip to content

Commit

Permalink
CREDENTIAL: More hacks?
Browse files Browse the repository at this point in the history
  • Loading branch information
mikewest committed Sep 8, 2015
1 parent 502f3ae commit f1ae5ef
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
14 changes: 9 additions & 5 deletions demos/credential-management/index.html
Expand Up @@ -29,11 +29,15 @@ <h1>Exciting Website</h1>
<p>Te vix odiô summo contêntiœnès! Né modo ïntéllegebàt éam. Agàm quas êum èû! Cû qùî affert patrioque. Pri an ïdqûè mëlîus, sèa êi illud vîtaë.</p>
</section>
<dialog>
<label for="username">Username:</label>
<input id="username" type="text" name="username" autocomplete="username"></input>
<label for="password">Password:</label>
<input id="password" type="password" name="password" autocomplete="new-password"></input>
<input type="submit">
<form>
<!-- UGLY HACK: working around https://crbug.com/529272
<label for="username">Username:</label>
<input id="username" type="text" name="username" autocomplete="username"></input>
<label for="password">Password:</label>
<input id="password" type="password" name="password" autocomplete="new-password"></input>
<input type="submit">
-->
</form>
</dialog>
</body>
</html>
Expand Down
7 changes: 4 additions & 3 deletions demos/credential-management/script.js
Expand Up @@ -50,8 +50,10 @@ document.querySelector('#signin').addEventListener('click', function () {
password: true
}).then(function (c) {
processResponse(c);
if (!c)
if (!c) {
document.querySelector('form').innerHTML = '<label for="username">Username:</label><input id="username" type="text" name="username" autocomplete="username"></input><label for="password">Password:</label><input id="password" type="password" name="password" autocomplete="new-password"></input><input type="submit">';
document.querySelector('dialog').showModal();
}
});
} else {
document.querySelector('dialog').showModal();
Expand All @@ -67,14 +69,13 @@ document.querySelector('#signout').addEventListener('click', function () {
navigator.credentials.requireUserMediation();
document.body.classList.toggle('signedin');
document.body.classList.toggle('signedout');

});

/*
* Finally, we'll wire up the submit button on the form to call `store()` upon
* submission if the API is available.
*/
document.querySelector('input[type=submit]').addEventListener('click', function (e) {
document.querySelector('form').addEventListener('submit', function (e) {
console.log("Submitted a sign-in form.");
e.preventDefault();

Expand Down

0 comments on commit f1ae5ef

Please sign in to comment.