action_auth 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/action_auth/application.js +6 -4
- data/app/assets/stylesheets/action_auth/application.css +4 -0
- data/app/controllers/action_auth/webauthn_credential_authentications_controller.rb +1 -1
- data/app/controllers/action_auth/webauthn_credentials_controller.rb +1 -1
- data/app/views/action_auth/webauthn_credential_authentications/new.html.erb +11 -5
- data/app/views/action_auth/webauthn_credentials/new.html.erb +8 -4
- data/app/views/layouts/action_auth/application-full-width.html.erb +1 -0
- data/app/views/layouts/action_auth/application.html.erb +8 -0
- data/lib/action_auth/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0d4717c14c8a74f3c08552d11dadd6a709a9d7d23972b61f3627afa8ded5775
|
4
|
+
data.tar.gz: 9f5339e1e752f85e1136339805d04b7738b228f426846858dc5c596f6594a130
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a1e71e5fa998a07f4bcd2c2db4be596b2d88da3a35545f53ad5242c7c51ee3c252a2be6086e727e6c5456426831a12608f9fe1c5c134f660057807ad363ef61
|
7
|
+
data.tar.gz: 80833cbffda59cf7335b3ab6fb9df49518ff510b391d450ec4805d09af3b6918f76f76800c495b4d4710be19bb9a66d324e8e6feec7deee8277f572f26936844
|
@@ -12,7 +12,7 @@ const Credential = {
|
|
12
12
|
}
|
13
13
|
},
|
14
14
|
|
15
|
-
callback: function (url, body) {
|
15
|
+
callback: function (url, body, redirectUrl) {
|
16
16
|
const token = this.getCRFSToken();
|
17
17
|
fetch(url, {
|
18
18
|
method: "POST",
|
@@ -25,7 +25,8 @@ const Credential = {
|
|
25
25
|
credentials: 'same-origin'
|
26
26
|
}).then(function (response) {
|
27
27
|
if (response.ok) {
|
28
|
-
|
28
|
+
console.log("Credential created", response);
|
29
|
+
window.location.replace(redirectUrl);
|
29
30
|
} else if (response.status < 500) {
|
30
31
|
response.text();
|
31
32
|
}
|
@@ -34,8 +35,9 @@ const Credential = {
|
|
34
35
|
|
35
36
|
create: function (callbackUrl, credentialOptions) {
|
36
37
|
const self = this;
|
38
|
+
const webauthnRedirectUrl = document.querySelector('meta[name="webauthn_redirect_url"]').getAttribute("content");
|
37
39
|
WebAuthnJSON.create({ "publicKey": credentialOptions }).then(function (credential) {
|
38
|
-
self.callback(callbackUrl, credential);
|
40
|
+
self.callback(callbackUrl, credential, webauthnRedirectUrl);
|
39
41
|
});
|
40
42
|
},
|
41
43
|
|
@@ -43,7 +45,7 @@ const Credential = {
|
|
43
45
|
const self = this;
|
44
46
|
const webauthnUrl = document.querySelector('meta[name="webauthn_auth_url"]').getAttribute("content");
|
45
47
|
WebAuthnJSON.get({ "publicKey": credentialOptions }).then(function (credential) {
|
46
|
-
self.callback(webauthnUrl, credential);
|
48
|
+
self.callback(webauthnUrl, credential, "/");
|
47
49
|
});
|
48
50
|
}
|
49
51
|
};
|
@@ -1,7 +1,7 @@
|
|
1
1
|
class ActionAuth::WebauthnCredentialAuthenticationsController < ApplicationController
|
2
2
|
before_action :ensure_user_not_authenticated
|
3
3
|
before_action :ensure_login_initiated
|
4
|
-
layout "action_auth/application
|
4
|
+
layout "action_auth/application"
|
5
5
|
|
6
6
|
def new
|
7
7
|
get_options = WebAuthn::Credential.options_for_get(allow: user.action_auth_webauthn_credentials.pluck(:external_id))
|
@@ -1,12 +1,18 @@
|
|
1
|
-
<h2 class="">Use
|
1
|
+
<h2 class="action-auth--text-center">Use a passkey to sign in</h2>
|
2
2
|
|
3
3
|
<%= content_tag :div,
|
4
4
|
id: "webauthn_credential_form",
|
5
|
-
data: {
|
6
|
-
|
5
|
+
data: {
|
6
|
+
controller: "credential-authenticator",
|
7
|
+
"credential-authenticator-options-value": @options
|
8
|
+
},
|
9
|
+
class: "action-auth--text-center" do %>
|
7
10
|
|
8
|
-
<div class="mb-3">
|
9
|
-
|
11
|
+
<div class="mb-3 action-auth--text-center">
|
12
|
+
Insert a USB key, if necessary, and tap it.
|
10
13
|
</div>
|
11
14
|
<% end %>
|
12
15
|
|
16
|
+
<%= content_for :cancel_path do %>
|
17
|
+
<%= link_to "Cancel", action_auth.sign_in_path %>
|
18
|
+
<% end %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
<h2 class="">Add a security key
|
1
|
+
<h2 class="action-auth--text-center">Add a security key</h2>
|
2
2
|
<%= form_with scope: :webauthn_credential,
|
3
3
|
url: options_for_webauthn_credentials_path,
|
4
4
|
id: "webauthn_credential_form",
|
@@ -11,11 +11,15 @@
|
|
11
11
|
<%= form.text_field :nickname, autofocus: true, placeholder: "New Security Key nickname", required: true %>
|
12
12
|
</div>
|
13
13
|
|
14
|
-
<div class="mb-3">
|
14
|
+
<div class="mb-3 action-auth--text-center">
|
15
15
|
<%= form.submit "Add Security Key", class: "btn btn-primary" %>
|
16
16
|
</div>
|
17
17
|
|
18
|
-
<div class="">
|
19
|
-
|
18
|
+
<div class="mb-3 action-auth--text-center">
|
19
|
+
Insert a USB key, if necessary, and tap it.
|
20
20
|
</div>
|
21
21
|
<% end %>
|
22
|
+
|
23
|
+
<%= content_for :cancel_path do %>
|
24
|
+
<%= link_to "Cancel", action_auth.sessions_path %>
|
25
|
+
<% end %>
|
@@ -9,6 +9,7 @@
|
|
9
9
|
<% if ActionAuth.configuration.webauthn_enabled? %>
|
10
10
|
<%= tag :meta, name: :webauthn_auth_url, content: action_auth.webauthn_credential_authentications_url %>
|
11
11
|
<%= tag :meta, name: :webauthn_cred_url, content: action_auth.webauthn_credentials_url %>
|
12
|
+
<%= tag :meta, name: :webauthn_redirect_url, content: action_auth.sessions_url %>
|
12
13
|
<% end %>
|
13
14
|
</head>
|
14
15
|
<body class="bg-light">
|
@@ -6,10 +6,18 @@
|
|
6
6
|
<%= csp_meta_tag %>
|
7
7
|
<%= stylesheet_link_tag "action_auth/application", media: "all" %>
|
8
8
|
<%= javascript_include_tag "action_auth/application", "data-turbo-track": "reload", type: "module" %>
|
9
|
+
<% if ActionAuth.configuration.webauthn_enabled? %>
|
10
|
+
<%= tag :meta, name: :webauthn_auth_url, content: action_auth.webauthn_credential_authentications_url %>
|
11
|
+
<%= tag :meta, name: :webauthn_cred_url, content: action_auth.webauthn_credentials_url %>
|
12
|
+
<%= tag :meta, name: :webauthn_redirect_url, content: action_auth.sessions_url %>
|
13
|
+
<% end %>
|
9
14
|
</head>
|
10
15
|
<body class="bg-light">
|
11
16
|
<div class="container bg-white border pb-3">
|
12
17
|
<%= yield %>
|
13
18
|
</div>
|
19
|
+
<div class="action-auth--text-center">
|
20
|
+
<%= yield(:cancel_path) %>
|
21
|
+
</div>
|
14
22
|
</body>
|
15
23
|
</html>
|
data/lib/action_auth/version.rb
CHANGED