Skip to content

Commit cb6629f

Browse files
committed
Merge pull request #427 from tehhi/use_password_and_local_credentials
[Credential manager API test] Creation of local credentials support old and new names.
2 parents eeac392 + 62cb0d5 commit cb6629f

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)