rails_authentication 0.1.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 +7 -0
- data/README.md +108 -0
- data/lib/generators/authentication/authentication_generator.rb +126 -0
- data/lib/generators/authentication/features/confirmable.rb +25 -0
- data/lib/generators/authentication/features/invitable.rb +26 -0
- data/lib/generators/authentication/features/lockable.rb +25 -0
- data/lib/generators/authentication/features/recoverable.rb +25 -0
- data/lib/generators/authentication/features/registerable.rb +17 -0
- data/lib/generators/authentication/features/rememberable.rb +16 -0
- data/lib/generators/authentication/features/timeoutable.rb +17 -0
- data/lib/generators/authentication/features/trackable.rb +17 -0
- data/lib/generators/authentication/features/validatable.rb +15 -0
- data/lib/generators/authentication/templates/app/controllers/concerns/authentication.rb.tt +96 -0
- data/lib/generators/authentication/templates/app/controllers/confirmations_controller.rb.tt +27 -0
- data/lib/generators/authentication/templates/app/controllers/invitations_controller.rb.tt +36 -0
- data/lib/generators/authentication/templates/app/controllers/passwords_controller.rb.tt +39 -0
- data/lib/generators/authentication/templates/app/controllers/registrations_controller.rb.tt +56 -0
- data/lib/generators/authentication/templates/app/controllers/sessions_controller.rb.tt +64 -0
- data/lib/generators/authentication/templates/app/controllers/unlocks_controller.rb.tt +23 -0
- data/lib/generators/authentication/templates/app/mailers/confirmations_mailer.rb.tt +10 -0
- data/lib/generators/authentication/templates/app/mailers/invitations_mailer.rb.tt +6 -0
- data/lib/generators/authentication/templates/app/mailers/passwords_mailer.rb.tt +6 -0
- data/lib/generators/authentication/templates/app/mailers/unlocks_mailer.rb.tt +6 -0
- data/lib/generators/authentication/templates/app/models/concerns/confirmable_concern.rb.tt +74 -0
- data/lib/generators/authentication/templates/app/models/concerns/invitable_concern.rb.tt +86 -0
- data/lib/generators/authentication/templates/app/models/concerns/lockable_concern.rb.tt +48 -0
- data/lib/generators/authentication/templates/app/models/concerns/recoverable_concern.rb.tt +33 -0
- data/lib/generators/authentication/templates/app/models/concerns/rememberable_concern.rb.tt +15 -0
- data/lib/generators/authentication/templates/app/models/concerns/timeoutable_concern.rb.tt +9 -0
- data/lib/generators/authentication/templates/app/models/concerns/trackable_concern.rb.tt +7 -0
- data/lib/generators/authentication/templates/app/models/concerns/validatable_concern.rb.tt +40 -0
- data/lib/generators/authentication/templates/app/models/user_auth.rb.tt +18 -0
- data/lib/generators/authentication/templates/app/views/confirmations/new.html.erb.tt +8 -0
- data/lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.html.erb.tt +6 -0
- data/lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.text.erb.tt +4 -0
- data/lib/generators/authentication/templates/app/views/invitations/edit.html.erb.tt +9 -0
- data/lib/generators/authentication/templates/app/views/invitations/new.html.erb.tt +9 -0
- data/lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.html.erb.tt +6 -0
- data/lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.text.erb.tt +4 -0
- data/lib/generators/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt +6 -0
- data/lib/generators/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt +4 -0
- data/lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt +22 -0
- data/lib/generators/authentication/templates/app/views/registrations/new.html.erb.tt +21 -0
- data/lib/generators/authentication/templates/app/views/sessions/new.html.erb.tt +23 -0
- data/lib/generators/authentication/templates/app/views/unlocks/new.html.erb.tt +8 -0
- data/lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.html.erb.tt +6 -0
- data/lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.text.erb.tt +6 -0
- data/lib/generators/authentication/templates/db/migrate/add_confirmable_to_users.rb.tt +12 -0
- data/lib/generators/authentication/templates/db/migrate/add_invitable_to_users.rb.tt +12 -0
- data/lib/generators/authentication/templates/db/migrate/add_lockable_to_users.rb.tt +9 -0
- data/lib/generators/authentication/templates/db/migrate/add_recoverable_to_users.rb.tt +8 -0
- data/lib/generators/authentication/templates/db/migrate/add_rememberable_to_users.rb.tt +5 -0
- data/lib/generators/authentication/templates/db/migrate/create_user_auths.rb.tt +14 -0
- data/lib/rails_authentication/version.rb +5 -0
- data/lib/rails_authentication.rb +6 -0
- metadata +112 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<h1>Resend unlock instructions</h1>
|
|
2
|
+
|
|
3
|
+
<%%= tag.div(flash[:alert], style: "color:red") if flash[:alert] %>
|
|
4
|
+
|
|
5
|
+
<%%= form_with url: unlocks_path do |form| %>
|
|
6
|
+
<%%= form.email_field :email_address, required: true, autofocus: true, autocomplete: "username", placeholder: "Enter your email address", value: params[:email_address] %><br>
|
|
7
|
+
<%%= form.submit "Resend unlock instructions" %>
|
|
8
|
+
<%% end %>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<p>
|
|
2
|
+
Your account has been locked due to too many failed sign-in attempts.
|
|
3
|
+
|
|
4
|
+
You can unlock it now on <%%= link_to "this unlock page", unlock_url(@user.unlock_token) %>,
|
|
5
|
+
or wait <%%= distance_of_time_in_words(0, LockableConcern::UNLOCK_IN) %> for the lock to expire on its own.
|
|
6
|
+
</p>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class AddConfirmableToUsers < ActiveRecord::Migration<%= migration_version %>
|
|
2
|
+
def change
|
|
3
|
+
add_column :users, :confirmation_token, :string
|
|
4
|
+
add_column :users, :confirmed_at, :datetime
|
|
5
|
+
add_column :users, :confirmation_sent_at, :datetime
|
|
6
|
+
<% if reconfirmable? -%>
|
|
7
|
+
add_column :users, :unconfirmed_email, :string
|
|
8
|
+
<% end -%>
|
|
9
|
+
|
|
10
|
+
add_index :users, :confirmation_token, unique: true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class AddInvitableToUsers < ActiveRecord::Migration<%= migration_version %>
|
|
2
|
+
def change
|
|
3
|
+
add_column :users, :invitation_token, :string
|
|
4
|
+
add_column :users, :invitation_created_at, :datetime
|
|
5
|
+
add_column :users, :invitation_sent_at, :datetime
|
|
6
|
+
add_column :users, :invitation_accepted_at, :datetime
|
|
7
|
+
add_column :users, :invitations_count, :integer, default: 0
|
|
8
|
+
add_reference :users, :invited_by, polymorphic: true
|
|
9
|
+
|
|
10
|
+
add_index :users, :invitation_token, unique: true
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
class AddLockableToUsers < ActiveRecord::Migration<%= migration_version %>
|
|
2
|
+
def change
|
|
3
|
+
add_column :users, :failed_attempts, :integer, default: 0, null: false
|
|
4
|
+
add_column :users, :unlock_token, :string
|
|
5
|
+
add_column :users, :locked_at, :datetime
|
|
6
|
+
|
|
7
|
+
add_index :users, :unlock_token, unique: true
|
|
8
|
+
end
|
|
9
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
class AddRecoverableToUsers < ActiveRecord::Migration<%= migration_version %>
|
|
2
|
+
def change
|
|
3
|
+
add_column :users, :reset_password_token, :string
|
|
4
|
+
add_column :users, :reset_password_sent_at, :datetime
|
|
5
|
+
|
|
6
|
+
add_index :users, :reset_password_token, unique: true
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreateUserAuths < ActiveRecord::Migration<%= migration_version %>
|
|
2
|
+
def change
|
|
3
|
+
create_table :user_auths do |t|
|
|
4
|
+
t.references :user, foreign_key: true
|
|
5
|
+
t.string :ip
|
|
6
|
+
t.string :user_agent
|
|
7
|
+
t.string :referrer
|
|
8
|
+
t.boolean :success, default: false, null: false
|
|
9
|
+
t.string :failure_reason
|
|
10
|
+
|
|
11
|
+
t.timestamps
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: rails_authentication
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- David Freerksen
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: railties
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '8.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '8.0'
|
|
26
|
+
description: Extends `bin/rails generate authentication` to install Confirmable, Recoverable,
|
|
27
|
+
Registerable, Rememberable, Trackable, Timeoutable, Validatable, Lockable, and Invitable
|
|
28
|
+
— all generated into your app as plain, editable code.
|
|
29
|
+
email:
|
|
30
|
+
- dfreerksen@gmail.com
|
|
31
|
+
executables: []
|
|
32
|
+
extensions: []
|
|
33
|
+
extra_rdoc_files: []
|
|
34
|
+
files:
|
|
35
|
+
- README.md
|
|
36
|
+
- lib/generators/authentication/authentication_generator.rb
|
|
37
|
+
- lib/generators/authentication/features/confirmable.rb
|
|
38
|
+
- lib/generators/authentication/features/invitable.rb
|
|
39
|
+
- lib/generators/authentication/features/lockable.rb
|
|
40
|
+
- lib/generators/authentication/features/recoverable.rb
|
|
41
|
+
- lib/generators/authentication/features/registerable.rb
|
|
42
|
+
- lib/generators/authentication/features/rememberable.rb
|
|
43
|
+
- lib/generators/authentication/features/timeoutable.rb
|
|
44
|
+
- lib/generators/authentication/features/trackable.rb
|
|
45
|
+
- lib/generators/authentication/features/validatable.rb
|
|
46
|
+
- lib/generators/authentication/templates/app/controllers/concerns/authentication.rb.tt
|
|
47
|
+
- lib/generators/authentication/templates/app/controllers/confirmations_controller.rb.tt
|
|
48
|
+
- lib/generators/authentication/templates/app/controllers/invitations_controller.rb.tt
|
|
49
|
+
- lib/generators/authentication/templates/app/controllers/passwords_controller.rb.tt
|
|
50
|
+
- lib/generators/authentication/templates/app/controllers/registrations_controller.rb.tt
|
|
51
|
+
- lib/generators/authentication/templates/app/controllers/sessions_controller.rb.tt
|
|
52
|
+
- lib/generators/authentication/templates/app/controllers/unlocks_controller.rb.tt
|
|
53
|
+
- lib/generators/authentication/templates/app/mailers/confirmations_mailer.rb.tt
|
|
54
|
+
- lib/generators/authentication/templates/app/mailers/invitations_mailer.rb.tt
|
|
55
|
+
- lib/generators/authentication/templates/app/mailers/passwords_mailer.rb.tt
|
|
56
|
+
- lib/generators/authentication/templates/app/mailers/unlocks_mailer.rb.tt
|
|
57
|
+
- lib/generators/authentication/templates/app/models/concerns/confirmable_concern.rb.tt
|
|
58
|
+
- lib/generators/authentication/templates/app/models/concerns/invitable_concern.rb.tt
|
|
59
|
+
- lib/generators/authentication/templates/app/models/concerns/lockable_concern.rb.tt
|
|
60
|
+
- lib/generators/authentication/templates/app/models/concerns/recoverable_concern.rb.tt
|
|
61
|
+
- lib/generators/authentication/templates/app/models/concerns/rememberable_concern.rb.tt
|
|
62
|
+
- lib/generators/authentication/templates/app/models/concerns/timeoutable_concern.rb.tt
|
|
63
|
+
- lib/generators/authentication/templates/app/models/concerns/trackable_concern.rb.tt
|
|
64
|
+
- lib/generators/authentication/templates/app/models/concerns/validatable_concern.rb.tt
|
|
65
|
+
- lib/generators/authentication/templates/app/models/user_auth.rb.tt
|
|
66
|
+
- lib/generators/authentication/templates/app/views/confirmations/new.html.erb.tt
|
|
67
|
+
- lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.html.erb.tt
|
|
68
|
+
- lib/generators/authentication/templates/app/views/confirmations_mailer/confirmation_instructions.text.erb.tt
|
|
69
|
+
- lib/generators/authentication/templates/app/views/invitations/edit.html.erb.tt
|
|
70
|
+
- lib/generators/authentication/templates/app/views/invitations/new.html.erb.tt
|
|
71
|
+
- lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.html.erb.tt
|
|
72
|
+
- lib/generators/authentication/templates/app/views/invitations_mailer/invitation_instructions.text.erb.tt
|
|
73
|
+
- lib/generators/authentication/templates/app/views/passwords_mailer/reset.html.erb.tt
|
|
74
|
+
- lib/generators/authentication/templates/app/views/passwords_mailer/reset.text.erb.tt
|
|
75
|
+
- lib/generators/authentication/templates/app/views/registrations/edit.html.erb.tt
|
|
76
|
+
- lib/generators/authentication/templates/app/views/registrations/new.html.erb.tt
|
|
77
|
+
- lib/generators/authentication/templates/app/views/sessions/new.html.erb.tt
|
|
78
|
+
- lib/generators/authentication/templates/app/views/unlocks/new.html.erb.tt
|
|
79
|
+
- lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.html.erb.tt
|
|
80
|
+
- lib/generators/authentication/templates/app/views/unlocks_mailer/unlock_instructions.text.erb.tt
|
|
81
|
+
- lib/generators/authentication/templates/db/migrate/add_confirmable_to_users.rb.tt
|
|
82
|
+
- lib/generators/authentication/templates/db/migrate/add_invitable_to_users.rb.tt
|
|
83
|
+
- lib/generators/authentication/templates/db/migrate/add_lockable_to_users.rb.tt
|
|
84
|
+
- lib/generators/authentication/templates/db/migrate/add_recoverable_to_users.rb.tt
|
|
85
|
+
- lib/generators/authentication/templates/db/migrate/add_rememberable_to_users.rb.tt
|
|
86
|
+
- lib/generators/authentication/templates/db/migrate/create_user_auths.rb.tt
|
|
87
|
+
- lib/rails_authentication.rb
|
|
88
|
+
- lib/rails_authentication/version.rb
|
|
89
|
+
homepage: https://github.com/dfreerksen/rails_authentication
|
|
90
|
+
licenses:
|
|
91
|
+
- MIT
|
|
92
|
+
metadata:
|
|
93
|
+
homepage_uri: https://github.com/dfreerksen/rails_authentication
|
|
94
|
+
source_code_uri: https://github.com/dfreerksen/rails_authentication
|
|
95
|
+
rdoc_options: []
|
|
96
|
+
require_paths:
|
|
97
|
+
- lib
|
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
99
|
+
requirements:
|
|
100
|
+
- - ">="
|
|
101
|
+
- !ruby/object:Gem::Version
|
|
102
|
+
version: '3.2'
|
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
|
+
requirements:
|
|
105
|
+
- - ">="
|
|
106
|
+
- !ruby/object:Gem::Version
|
|
107
|
+
version: '0'
|
|
108
|
+
requirements: []
|
|
109
|
+
rubygems_version: 3.6.9
|
|
110
|
+
specification_version: 4
|
|
111
|
+
summary: Devise-style features on top of Rails 8's built-in authentication generator
|
|
112
|
+
test_files: []
|