Skip to content

Commit 5afc14b

Browse files
authored
fix: fix javascript resource in case no key is registered yet (#30)
1 parent bcf3b50 commit 5afc14b

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,6 @@ indent_size = 4
1313

1414
[*.blade.php]
1515
indent_size = 2
16+
17+
[*.js]
18+
indent_size = 2

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
### Fixes:
1010
*
1111

12+
1213
# RELEASED VERSIONS:
1314

15+
## 0.4.1 - 2019-04-18
16+
### Fixes:
17+
* Fix javascript resource in case no key is registered yet
18+
1419
## 0.4.0 - 2019-04-18
1520
### New features:
1621
* Add resources files to client adoption

resources/js/webauthn.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ class WebAuthn {
3333
let publicKeyCredential = Object.assign({}, publicKey);
3434
publicKeyCredential.user.id = this._bufferDecode(publicKey.user.id);
3535
publicKeyCredential.challenge = this._bufferDecode(publicKey.challenge);
36-
publicKeyCredential.excludeCredentials = this._credentialDecode(publicKey.excludeCredentials);
36+
if (publicKey.excludeCredentials) {
37+
publicKeyCredential.excludeCredentials = this._credentialDecode(publicKey.excludeCredentials);
38+
}
3739

3840
var self = this;
3941
navigator.credentials.create({
@@ -75,7 +77,9 @@ class WebAuthn {
7577
sign(publicKey, callback) {
7678
let publicKeyCredential = Object.assign({}, publicKey);
7779
publicKeyCredential.challenge = this._bufferDecode(publicKey.challenge);
78-
publicKeyCredential.allowCredentials = this._credentialDecode(publicKey.allowCredentials);
80+
if (publicKey.allowCredentials) {
81+
publicKeyCredential.allowCredentials = this._credentialDecode(publicKey.allowCredentials);
82+
}
7983

8084
var self = this;
8185
navigator.credentials.get({

resources/views/authenticate.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<div id="app">
3232
<main class="py-4">
3333
<div class="container">
34-
<div class="row">
34+
<div class="row justify-content-center">
3535
<div class="col-xs-12 col-md-6 col-md-offset-3 col-md-offset-3-right ">
3636
<div class="card">
3737
<div class="card-header">{{ trans('webauthn::messages.auth.title') }}</div>

0 commit comments

Comments
 (0)