rails_authentication 0.1.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 305e121fa18342571e89ab2bee6cf11f34ba708c08c2c17fb85e5880b2f0ab56
4
- data.tar.gz: b62fec7dddeaf09e159321f396b2723f3b5793f7c71fc72af3044c49987e6c86
3
+ metadata.gz: 295b9ad4f9523b3ebf770bc6a57f0c85d22d16ee648ed673f7cc82fbf36f671b
4
+ data.tar.gz: 1a2506b6aa09b8fffb852018be8fd5d6a483d0841f206b7c1dda57c03e7ab7e7
5
5
  SHA512:
6
- metadata.gz: b35c71dd413c7e12398bdfd2b04f78e2e5669484254af2c9125958a69072ff2904d41bf858800f3853a48fb5aac20616425ae438407df8ed9045db742e6d0d8e
7
- data.tar.gz: dfa8c8b76bff7b8d907bda610db59b3fd8fbbf580722f659f20cef9c2153b6ea56f69d531a879dded44d94820748074bb88f8da4f2397c61c2c3e778e68ff47a
6
+ metadata.gz: 77f7e36463e7e20a7cbed9ebe00148c4dc5ec8c72d3390a4af62edeae30ced60c5beb01b50f4af047bf47e4a91d18a2b528166f92abb521058be4a4d91d2df7f
7
+ data.tar.gz: 86401354eaa5584a234a7dc46ed005e7c9e7daebcc3811008938b5472aa1b4055bbc831acac13ded99ff7f55f8a16fe69591e59fffb8c8b6b42adfab551e9dba
data/README.md CHANGED
@@ -16,7 +16,7 @@ gem extends that same command to also install:
16
16
  | **Timeoutable** | Expires sessions after 30 minutes of inactivity |
17
17
  | **Validatable** | Email format/uniqueness, password length, and password complexity validations |
18
18
  | **Lockable** | Locks the account after 5 failed attempts; unlock via email or automatically after 1 hour |
19
- | **Invitable** | Invite users by email; they accept by choosing their own password |
19
+ | **Invitable** | Invite users by email; blocks sign-in until they accept by choosing their own password |
20
20
 
21
21
  Everything is **generated into your app** as plain, readable code — controllers, views, mailers,
22
22
  migrations, and one model concern per feature. There is no runtime dependency on this gem: after
@@ -94,6 +94,13 @@ module RailsAuthentication
94
94
  generate_invitable if invitable?
95
95
  end
96
96
 
97
+ # Runs after every feature install so the blank line separates the concern
98
+ # includes (if any) from the rest of the class body, no matter which features
99
+ # are enabled.
100
+ def format_user_model
101
+ inject_into_file "app/models/user.rb", "\n", after: /(?: include \w+Concern\n)+/, force: true
102
+ end
103
+
97
104
  # Confirmable, Rememberable, Trackable, Timeoutable, and Lockable all hook into the
98
105
  # sign-in flow, so the base generator's session files are replaced with versions
99
106
  # rendered from the enabled feature set. Overwriting is safe: the base copies were
@@ -33,6 +33,19 @@ class SessionsController < ApplicationController
33
33
  <% end -%>
34
34
  redirect_to new_session_path, alert: "You must confirm your email address before signing in."
35
35
  <% end -%>
36
+ <% if invitable? -%>
37
+ elsif user.invitation_pending?
38
+ <% if trackable? -%>
39
+ record_authentication_attempt(user, success: false, failure_reason: "invitation_pending")
40
+ <% end -%>
41
+ redirect_to new_session_path, alert: "You must accept your invitation before signing in."
42
+ <% end -%>
43
+ # Add your own authentication restrictions specific to your application
44
+ # elsif user.deleted_at.present?
45
+ <% if trackable? -%>
46
+ # record_authentication_attempt(user, success: false, failure_reason: "soft_deleted")
47
+ <% end -%>
48
+ # redirect_to new_session_path, alert: "Your account is not available."
36
49
  else
37
50
  <% if lockable? -%>
38
51
  user.reset_failed_attempts!
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsAuthentication
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Freerksen
@@ -106,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
106
  - !ruby/object:Gem::Version
107
107
  version: '0'
108
108
  requirements: []
109
- rubygems_version: 3.6.9
109
+ rubygems_version: 4.0.16
110
110
  specification_version: 4
111
111
  summary: Devise-style features on top of Rails 8's built-in authentication generator
112
112
  test_files: []