Skip to content

Commit 68375b4

Browse files
committed
CREDENTIAL: Tweak demo so that it works with yesterday's Canary. Will revert this tomorrow.
1 parent fbd9dac commit 68375b4

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

demos/credential-management/index.html

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,18 @@ <h2>Sign Up!</h2>
7373
document.querySelector('#signup').addEventListener('submit', function (e) {
7474
if (navigator.credentials) {
7575
console.log("Creating credentials!");
76-
var c = new PasswordCredential({
77-
id: document.querySelector('#username-signup').value,
78-
password: document.querySelector('#password-signup').value
79-
});
76+
var c;
77+
try {
78+
c = new PasswordCredential({
79+
id: document.querySelector('#username-signup').value,
80+
password: document.querySelector('#password-signup').value
81+
});
82+
} catch (e) {
83+
c = new PasswordCredential(
84+
document.querySelector('#username-signup').value,
85+
document.querySelector('#password-signup').value
86+
);
87+
}
8088
navigator.credentials.store(c).then(function () {
8189
console.log("Stored credential!");
8290
});

0 commit comments

Comments
 (0)