action_auth 0.2.13 → 0.2.15
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e857cd3b20f2efab695368d0b8b127a63cfe1639ef44dc4d346399c8aa446f7
|
4
|
+
data.tar.gz: 791837aee1c820e999896082cbdec807b65a0df7db1d29de02b31774682c5448
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f881d2e71ec6d1f2f1a5ccc764a9eecb333671163cba5ae8958e4a0b36c408f9670d05e818ce4ff1ab244583f2738f4376f9e8e987cc418748c8fce3217ee4ce
|
7
|
+
data.tar.gz: 30773441bd4c9184638cedba7ee4bb8a635f72a761bf6cc6abee5da65c26a4bdbe3cbd4aa72d7774a514276db539818e1b9f89b860c5a790b6a6785a898297d0
|
@@ -76,24 +76,40 @@ Stimulus.register(
|
|
76
76
|
}
|
77
77
|
);
|
78
78
|
|
79
|
-
|
80
|
-
const
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
79
|
+
function submitFormWithTurbo(form) {
|
80
|
+
const formData = new FormData(form);
|
81
|
+
fetch(form.action, {
|
82
|
+
method: 'POST',
|
83
|
+
body: formData,
|
84
|
+
headers: {
|
85
|
+
'X-CSRF-Token': document.querySelector('[name="csrf-token"]').content
|
86
|
+
},
|
87
|
+
credentials: 'same-origin'
|
88
|
+
}).then(response => {
|
89
|
+
return response.json();
|
90
|
+
}).then(data => {
|
91
|
+
form.dispatchEvent(new CustomEvent('ajax:success', { detail: data }));
|
92
|
+
});
|
93
|
+
}
|
94
|
+
|
95
|
+
if (!window.Turbo) {
|
96
|
+
document.addEventListener('DOMContentLoaded', function () {
|
97
|
+
const form = document.getElementById('webauthn_credential_form');
|
98
|
+
if (form) {
|
99
|
+
form.addEventListener('submit', function (event) {
|
100
|
+
event.preventDefault();
|
101
|
+
submitFormWithTurbo(form);
|
96
102
|
});
|
97
|
-
}
|
98
|
-
}
|
99
|
-
}
|
103
|
+
}
|
104
|
+
});
|
105
|
+
} else {
|
106
|
+
document.addEventListener('turbo:load', function () {
|
107
|
+
const form = document.getElementById('webauthn_credential_form');
|
108
|
+
if (form) {
|
109
|
+
form.addEventListener('submit', function (event) {
|
110
|
+
event.preventDefault();
|
111
|
+
submitFormWithTurbo(form);
|
112
|
+
});
|
113
|
+
}
|
114
|
+
});
|
115
|
+
}
|
@@ -22,7 +22,9 @@ class ActionAuth::WebauthnCredentialsController < ApplicationController
|
|
22
22
|
|
23
23
|
respond_to do |format|
|
24
24
|
format.json { render json: create_options }
|
25
|
-
|
25
|
+
if defined?(Turbo)
|
26
|
+
format.turbo_stream { render json: create_options }
|
27
|
+
end
|
26
28
|
end
|
27
29
|
end
|
28
30
|
|
data/lib/action_auth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: action_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Kimura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01
|
11
|
+
date: 2024-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|