rodauth-rails 0.4.2 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +39 -1
  3. data/README.md +419 -83
  4. data/lib/generators/rodauth/install_generator.rb +38 -23
  5. data/lib/generators/rodauth/migration/account_expiration.erb +7 -0
  6. data/lib/generators/rodauth/migration/active_sessions.erb +7 -0
  7. data/lib/generators/rodauth/migration/audit_logging.erb +16 -0
  8. data/lib/generators/rodauth/migration/base.erb +19 -0
  9. data/lib/generators/rodauth/migration/disallow_password_reuse.erb +5 -0
  10. data/lib/generators/rodauth/migration/email_auth.erb +7 -0
  11. data/lib/generators/rodauth/migration/jwt_refresh.erb +7 -0
  12. data/lib/generators/rodauth/migration/lockout.erb +11 -0
  13. data/lib/generators/rodauth/migration/otp.erb +7 -0
  14. data/lib/generators/rodauth/migration/password_expiration.erb +5 -0
  15. data/lib/generators/rodauth/migration/recovery_codes.erb +6 -0
  16. data/lib/generators/rodauth/migration/remember.erb +6 -0
  17. data/lib/generators/rodauth/migration/reset_password.erb +7 -0
  18. data/lib/generators/rodauth/migration/single_session.erb +5 -0
  19. data/lib/generators/rodauth/migration/sms_codes.erb +8 -0
  20. data/lib/generators/rodauth/migration/verify_account.erb +7 -0
  21. data/lib/generators/rodauth/migration/verify_login_change.erb +7 -0
  22. data/lib/generators/rodauth/migration/webauthn.erb +12 -0
  23. data/lib/generators/rodauth/migration_generator.rb +32 -0
  24. data/lib/generators/rodauth/migration_helpers.rb +69 -0
  25. data/lib/generators/rodauth/templates/app/controllers/rodauth_controller.rb +2 -1
  26. data/lib/generators/rodauth/templates/app/lib/rodauth_app.rb +18 -20
  27. data/lib/generators/rodauth/templates/config/initializers/sequel.rb +1 -5
  28. data/lib/generators/rodauth/templates/db/migrate/create_rodauth.rb +2 -176
  29. data/lib/rodauth/rails.rb +33 -4
  30. data/lib/rodauth/rails/app.rb +6 -2
  31. data/lib/rodauth/rails/app/flash.rb +1 -1
  32. data/lib/rodauth/rails/app/middleware.rb +26 -0
  33. data/lib/rodauth/rails/feature.rb +100 -30
  34. data/lib/rodauth/rails/railtie.rb +6 -0
  35. data/lib/rodauth/rails/tasks.rake +28 -0
  36. data/lib/rodauth/rails/version.rb +1 -1
  37. data/rodauth-rails.gemspec +1 -1
  38. metadata +26 -5
  39. data/lib/rodauth/features/rails.rb +0 -1
@@ -1,6 +1,8 @@
1
1
  require "rodauth/rails/middleware"
2
2
  require "rodauth/rails/controller_methods"
3
3
 
4
+ require "rails"
5
+
4
6
  module Rodauth
5
7
  module Rails
6
8
  class Railtie < ::Rails::Railtie
@@ -18,6 +20,10 @@ module Rodauth
18
20
  # Rodauth uses RACK_ENV to set the default bcrypt hash cost
19
21
  ENV["RACK_ENV"] = "test" if ::Rails.env.test?
20
22
  end
23
+
24
+ rake_tasks do
25
+ load "rodauth/rails/tasks.rake"
26
+ end
21
27
  end
22
28
  end
23
29
  end
@@ -0,0 +1,28 @@
1
+ namespace :rodauth do
2
+ task routes: :environment do
3
+ app = Rodauth::Rails.app
4
+
5
+ puts "Routes handled by #{app}:"
6
+
7
+ app.opts[:rodauths].each_key do |rodauth_name|
8
+ rodauth = Rodauth::Rails.rodauth(rodauth_name)
9
+
10
+ routes = rodauth.class.routes.map do |handle_method|
11
+ path_method = "#{handle_method.to_s.sub(/\Ahandle_/, "")}_path"
12
+
13
+ [
14
+ rodauth.public_send(path_method),
15
+ "rodauth#{rodauth_name && "(:#{rodauth_name})"}.#{path_method}",
16
+ ]
17
+ end
18
+
19
+ padding = routes.map { |path, _| path.length }.max
20
+
21
+ route_lines = routes.map do |path, code|
22
+ "#{path.ljust(padding)} #{code}"
23
+ end
24
+
25
+ puts "\n #{route_lines.join("\n ")}"
26
+ end
27
+ end
28
+ end
@@ -1,5 +1,5 @@
1
1
  module Rodauth
2
2
  module Rails
3
- VERSION = "0.4.2"
3
+ VERSION = "0.8.0"
4
4
  end
5
5
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_dependency "railties", ">= 4.2", "< 7"
20
- spec.add_dependency "rodauth", "~> 2.1"
20
+ spec.add_dependency "rodauth", "~> 2.7"
21
21
  spec.add_dependency "sequel-activerecord_connection", "~> 1.1"
22
22
  spec.add_dependency "tilt"
23
23
  spec.add_dependency "bcrypt"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rodauth-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Janko Marohnić
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-08 00:00:00.000000000 Z
11
+ date: 2021-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -36,14 +36,14 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.1'
39
+ version: '2.7'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
43
43
  requirements:
44
44
  - - "~>"
45
45
  - !ruby/object:Gem::Version
46
- version: '2.1'
46
+ version: '2.7'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sequel-activerecord_connection
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -98,6 +98,26 @@ files:
98
98
  - README.md
99
99
  - lib/generators/rodauth/install_generator.rb
100
100
  - lib/generators/rodauth/mailer_generator.rb
101
+ - lib/generators/rodauth/migration/account_expiration.erb
102
+ - lib/generators/rodauth/migration/active_sessions.erb
103
+ - lib/generators/rodauth/migration/audit_logging.erb
104
+ - lib/generators/rodauth/migration/base.erb
105
+ - lib/generators/rodauth/migration/disallow_password_reuse.erb
106
+ - lib/generators/rodauth/migration/email_auth.erb
107
+ - lib/generators/rodauth/migration/jwt_refresh.erb
108
+ - lib/generators/rodauth/migration/lockout.erb
109
+ - lib/generators/rodauth/migration/otp.erb
110
+ - lib/generators/rodauth/migration/password_expiration.erb
111
+ - lib/generators/rodauth/migration/recovery_codes.erb
112
+ - lib/generators/rodauth/migration/remember.erb
113
+ - lib/generators/rodauth/migration/reset_password.erb
114
+ - lib/generators/rodauth/migration/single_session.erb
115
+ - lib/generators/rodauth/migration/sms_codes.erb
116
+ - lib/generators/rodauth/migration/verify_account.erb
117
+ - lib/generators/rodauth/migration/verify_login_change.erb
118
+ - lib/generators/rodauth/migration/webauthn.erb
119
+ - lib/generators/rodauth/migration_generator.rb
120
+ - lib/generators/rodauth/migration_helpers.rb
101
121
  - lib/generators/rodauth/templates/app/controllers/rodauth_controller.rb
102
122
  - lib/generators/rodauth/templates/app/lib/rodauth_app.rb
103
123
  - lib/generators/rodauth/templates/app/mailers/rodauth_mailer.rb
@@ -167,14 +187,15 @@ files:
167
187
  - lib/generators/rodauth/templates/db/migrate/create_rodauth.rb
168
188
  - lib/generators/rodauth/views_generator.rb
169
189
  - lib/rodauth-rails.rb
170
- - lib/rodauth/features/rails.rb
171
190
  - lib/rodauth/rails.rb
172
191
  - lib/rodauth/rails/app.rb
173
192
  - lib/rodauth/rails/app/flash.rb
193
+ - lib/rodauth/rails/app/middleware.rb
174
194
  - lib/rodauth/rails/controller_methods.rb
175
195
  - lib/rodauth/rails/feature.rb
176
196
  - lib/rodauth/rails/middleware.rb
177
197
  - lib/rodauth/rails/railtie.rb
198
+ - lib/rodauth/rails/tasks.rake
178
199
  - lib/rodauth/rails/version.rb
179
200
  - rodauth-rails.gemspec
180
201
  homepage: https://github.com/janko/rodauth-rails
@@ -1 +0,0 @@
1
- require "rodauth/rails/feature"