action_auth 0.2.14 → 0.3.0
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 +36 -20
- data/app/controllers/action_auth/identity/email_verifications_controller.rb +2 -2
- data/app/controllers/action_auth/identity/emails_controller.rb +2 -2
- data/app/controllers/action_auth/identity/password_resets_controller.rb +1 -1
- data/app/controllers/action_auth/passwords_controller.rb +1 -1
- data/app/controllers/action_auth/registrations_controller.rb +2 -2
- data/app/controllers/action_auth/webauthn_credentials_controller.rb +3 -1
- data/lib/action_auth/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa8d3dbc8281ff24b428e82568470f21268c085d94352302c4f5bf4134041526
|
4
|
+
data.tar.gz: e266314b2359d22db1983ae7a9a13ddda8fd589819c834ccb5fb5e28418176a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd44e5d7bc676a69f0b7d60196a68b02c77ea9c7c042faa3251acce7b937e6a13fa7f8e44d4c982dc1d45a28d6e29124d7489f06649bd97296278964c409d12e
|
7
|
+
data.tar.gz: 288208466865e199fd803d5dc57fcb537467c166084be4812261083742de66d3314a86b287f612e261bfba7ed4ebd4c35ddcfd7199ad99de9aac8ea04937dbf1
|
@@ -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
|
+
}
|
@@ -5,13 +5,13 @@ module ActionAuth
|
|
5
5
|
|
6
6
|
def show
|
7
7
|
@user.update! verified: true
|
8
|
-
redirect_to
|
8
|
+
redirect_to sign_in_path, notice: "Thank you for verifying your email address"
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
12
|
user = ActionAuth::User.find_by(email: params[:email])
|
13
13
|
UserMailer.with(user: user).email_verification.deliver_later if user
|
14
|
-
redirect_to
|
14
|
+
redirect_to sign_in_path, notice: "We sent a verification email to your email address"
|
15
15
|
end
|
16
16
|
|
17
17
|
private
|
@@ -27,9 +27,9 @@ module ActionAuth
|
|
27
27
|
def redirect_to_root
|
28
28
|
if @user.email_previously_changed?
|
29
29
|
resend_email_verification
|
30
|
-
redirect_to
|
30
|
+
redirect_to sign_in_path, notice: "Your email has been changed. Check your email to verify your email."
|
31
31
|
else
|
32
|
-
redirect_to
|
32
|
+
redirect_to sign_in_path
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -14,7 +14,7 @@ module ActionAuth
|
|
14
14
|
send_password_reset_email
|
15
15
|
redirect_to sign_in_path, notice: "Check your email for reset instructions"
|
16
16
|
else
|
17
|
-
redirect_to
|
17
|
+
redirect_to sign_in_path, alert: "You can't reset your password until you verify your email"
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -7,7 +7,7 @@ module ActionAuth
|
|
7
7
|
|
8
8
|
def update
|
9
9
|
if @user.update(user_params)
|
10
|
-
redirect_to
|
10
|
+
redirect_to sign_in_path, notice: "Your password has been changed"
|
11
11
|
else
|
12
12
|
render :edit, status: :unprocessable_entity
|
13
13
|
end
|
@@ -10,12 +10,12 @@ module ActionAuth
|
|
10
10
|
if @user.save
|
11
11
|
if ActionAuth.configuration.verify_email_on_sign_in
|
12
12
|
send_email_verification
|
13
|
-
redirect_to
|
13
|
+
redirect_to sign_in_path, notice: "Welcome! You have signed up successfully. Please check your email to verify your account."
|
14
14
|
else
|
15
15
|
session_record = @user.action_auth_sessions.create!
|
16
16
|
cookies.signed.permanent[:session_token] = { value: session_record.id, httponly: true }
|
17
17
|
|
18
|
-
redirect_to
|
18
|
+
redirect_to sign_in_path, notice: "Welcome! You have signed up successfully"
|
19
19
|
end
|
20
20
|
else
|
21
21
|
render :new, status: :unprocessable_entity
|
@@ -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.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2024-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
120
|
- !ruby/object:Gem::Version
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
|
-
rubygems_version: 3.5.
|
123
|
+
rubygems_version: 3.5.6
|
124
124
|
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: A simple Rails engine for authorization.
|