Skip to content

Commit 62cb0d5

Browse files
author
Tatiana Gornak
committed
[Credential manager API test] Updates creation of local credentials.
1 parent 9f935df commit 62cb0d5

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

demos/credential-management-api-test/credential.html

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,21 @@ <h1>AN AMAZING DEMO OF THE ASTOUNDING CREDENTIAL MANAGER API!</h1>
9898
function createCredentialFromForm(form) {
9999
try {
100100
if (form.elements['type'].value == "local") {
101-
return new LocalCredential(
101+
try {
102+
return new PasswordCredential(
102103
form.elements['username'].value,
103104
form.elements['password'].value,
104105
form.elements['friendly'].value,
105106
form.elements['avatar'].value);
107+
} catch (e) {
108+
if (!(e instanceof ReferenceError))
109+
throw e;
110+
return new LocalCredential(
111+
form.elements['username'].value,
112+
form.elements['password'].value,
113+
form.elements['friendly'].value,
114+
form.elements['avatar'].value);
115+
}
106116
} else {
107117
return new FederatedCredential(
108118
form.elements['username'].value,

0 commit comments

Comments
 (0)