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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 833b67b5320991ffda2c7a9bf6bc7e7b0c38d2cd725ffec5060db45bd64ab247
4
- data.tar.gz: f9f2e1c7dc63d26595d2188c9b7c7ccdcbdd93d0debd90c96450dd8c3246e7a6
3
+ metadata.gz: dfb772199a2e02caffc9981547bdaad51ace6468e80bbae4c1123199fb5a23b1
4
+ data.tar.gz: 5334fce103771564856a60e164e8d430808bf472f9ec0296e25494e7b7fcb77e
5
5
  SHA512:
6
- metadata.gz: a141534bd16cdc1d343f36903fb6b08585740dee6f00a6525ada9fa7cba3abb67e88e3073025de74bd57125ec41b138ef44ee643ef0ce1a223ef0553b641e55f
7
- data.tar.gz: eabbec0f09c5a2bcac0a4deaa858ce74917f5e03c059229ea4e22cc0b682c8c44e641a0c6f7dd8d732bb65002e8b7d658045008c8cee73fe940e8dabbb91685e
6
+ metadata.gz: 79918e0da74283c432ddf797abad040a3fade7923f61c9d5e055d0cc15728b1f975e09ea6e6be669810979a9b3f1d9c054c3a07288c406bfe96c89a42c118a5a
7
+ data.tar.gz: 334b0d68ae98187e9b909f34d325cdcaffe051c7ada97045a7d8d90169be60defcd881b09b339764c3791c9ce0b2c326681fd943deeb58165928b696eb34355d
data/README.md CHANGED
@@ -1,9 +1,11 @@
1
1
  # ActionAuth
2
- ActionAuth is a Rails engine that provides a simple authentication system for your Rails application.
3
- It uses the latest methods for authentication and handling reset tokens from Rails 7.1.0.
4
- It is designed to be simple and easy to use and allows you to focus on building your application.
5
- The functionality of this gem relies on ActiveSupport::CurrentAttributes the methods are
6
- designed to have a similar experience as Devise.
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
+ [![Ruby](https://github.com/kobaltz/action_auth/actions/workflows/test.yml/badge.svg)](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
- send_email_verification
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: identity_email_path, method: :patch) do |form| %>
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><%# link_to "Yes, use this email for my account", identity_email_verification_url(sid: @signed_id) %></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
 
@@ -1,3 +1,3 @@
1
1
  module ActionAuth
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Kimura