action_auth 0.1.4 → 0.1.5
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/README.md +43 -5
- data/app/controllers/action_auth/identity/email_verifications_controller.rb +2 -5
- data/app/models/action_auth/user.rb +0 -2
- data/app/views/action_auth/identity/emails/edit.html.erb +5 -1
- data/app/views/action_auth/user_mailer/email_verification.html.erb +1 -1
- 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: dfb772199a2e02caffc9981547bdaad51ace6468e80bbae4c1123199fb5a23b1
|
4
|
+
data.tar.gz: 5334fce103771564856a60e164e8d430808bf472f9ec0296e25494e7b7fcb77e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79918e0da74283c432ddf797abad040a3fade7923f61c9d5e055d0cc15728b1f975e09ea6e6be669810979a9b3f1d9c054c3a07288c406bfe96c89a42c118a5a
|
7
|
+
data.tar.gz: 334b0d68ae98187e9b909f34d325cdcaffe051c7ada97045a7d8d90169be60defcd881b09b339764c3791c9ce0b2c326681fd943deeb58165928b696eb34355d
|
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
# ActionAuth
|
2
|
-
ActionAuth is
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
ActionAuth is an authentication Rails engine crafted to integrate seamlessly
|
3
|
+
with your Rails application. Optimized for Rails 7.1.0, it employs the most modern authentication
|
4
|
+
techniques and streamlined token reset processes. Its simplicity and ease of use let you concentrate
|
5
|
+
on developing your application, while its reliance on ActiveSupport::CurrentAttributes ensures a
|
6
|
+
user experience akin to that offered by the well-regarded Devise gem.
|
7
|
+
|
8
|
+
[](https://github.com/kobaltz/action_auth/actions/workflows/test.yml)
|
7
9
|
|
8
10
|
## Installation
|
9
11
|
Add this line to your application's Gemfile:
|
@@ -31,6 +33,36 @@ In your view layout
|
|
31
33
|
<% end %>
|
32
34
|
```
|
33
35
|
|
36
|
+
## Features
|
37
|
+
|
38
|
+
These are the planned features for ActionAuth. The ones that are checked off are currently implemented. The ones that are not checked off are planned for future releases.
|
39
|
+
|
40
|
+
✅ - Sign Up, Sign In, Sign Out
|
41
|
+
|
42
|
+
✅ - Password reset
|
43
|
+
|
44
|
+
✅ - Account Email Verification
|
45
|
+
|
46
|
+
✅ - Cookie-based sessions
|
47
|
+
|
48
|
+
⏳ - Multifactor Authentication
|
49
|
+
|
50
|
+
⏳ - Passkeys/Hardware Security Keys
|
51
|
+
|
52
|
+
⏳ - Magic Links
|
53
|
+
|
54
|
+
⏳ - OAuth with Google, Facebook, Github, Twitter, etc.
|
55
|
+
|
56
|
+
⏳ - Account Deletion
|
57
|
+
|
58
|
+
⏳ - Account Lockout
|
59
|
+
|
60
|
+
⏳ - Account Suspension
|
61
|
+
|
62
|
+
⏳ - Account Impersonation
|
63
|
+
|
64
|
+
|
65
|
+
|
34
66
|
## Usage
|
35
67
|
|
36
68
|
### Routes
|
@@ -54,3 +86,9 @@ Within your application, you'll have access to these routes. They have been styl
|
|
54
86
|
|
55
87
|
## License
|
56
88
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
89
|
+
|
90
|
+
|
91
|
+
## Credits
|
92
|
+
|
93
|
+
Heavily inspired by [Drifting Ruby #300](https://www.driftingruby.com/episodes/authentication-from-scratch)
|
94
|
+
and [Authentication Zero](https://github.com/lazaronixon/authentication-zero).
|
@@ -9,7 +9,8 @@ module ActionAuth
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def create
|
12
|
-
|
12
|
+
user = ActionAuth::User.find_by(email: params[:email])
|
13
|
+
UserMailer.with(user: user).email_verification.deliver_later if user
|
13
14
|
redirect_to main_app.root_path, notice: "We sent a verification email to your email address"
|
14
15
|
end
|
15
16
|
|
@@ -21,10 +22,6 @@ module ActionAuth
|
|
21
22
|
redirect_to edit_identity_email_path, alert: "That email verification link is invalid"
|
22
23
|
end
|
23
24
|
|
24
|
-
def send_email_verification
|
25
|
-
return unless Current.user
|
26
|
-
UserMailer.with(user: Current.user).email_verification.deliver_later
|
27
|
-
end
|
28
25
|
end
|
29
26
|
end
|
30
27
|
end
|
@@ -10,7 +10,6 @@ module ActionAuth
|
|
10
10
|
password_salt.last(10)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
13
|
has_many :action_auth_sessions, dependent: :destroy, class_name: "ActionAuth::Session", foreign_key: "action_auth_user_id"
|
15
14
|
|
16
15
|
validates :email, presence: true, uniqueness: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
@@ -18,7 +17,6 @@ module ActionAuth
|
|
18
17
|
|
19
18
|
normalizes :email, with: -> email { email.strip.downcase }
|
20
19
|
|
21
|
-
|
22
20
|
before_validation if: :email_changed?, on: :update do
|
23
21
|
self.verified = false
|
24
22
|
end
|
@@ -3,16 +3,20 @@
|
|
3
3
|
<% header_text = "Change Your Email" %>
|
4
4
|
<% label_text = "New email" %>
|
5
5
|
<% button_text = "Save changes" %>
|
6
|
+
<% form_url = identity_email_path %>
|
7
|
+
<% form_method = :patch %>
|
6
8
|
<% else %>
|
7
9
|
<% header_text = "Verify Your Email" %>
|
8
10
|
<% label_text = "Email" %>
|
9
11
|
<% button_text = "Send verification email" %>
|
12
|
+
<% form_url = identity_email_verification_path %>
|
13
|
+
<% form_method = :post %>
|
10
14
|
<% end %>
|
11
15
|
<h1><%= header_text %></h1>
|
12
16
|
|
13
17
|
<p style="color: red"><%= alert %></p>
|
14
18
|
|
15
|
-
<%= form_with(url:
|
19
|
+
<%= form_with(url: form_url, method: form_method) do |form| %>
|
16
20
|
<% if @user&.errors&.any? %>
|
17
21
|
<div style="color: red">
|
18
22
|
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<p><strong>You must hit the link below to confirm that you received this email.</strong></p>
|
6
6
|
|
7
|
-
<p
|
7
|
+
<p><%= link_to "Yes, use this email for my account", identity_email_verification_url(sid: @signed_id) %></p>
|
8
8
|
|
9
9
|
<hr>
|
10
10
|
|
data/lib/action_auth/version.rb
CHANGED