rodauth-rails 0.4.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -0
  3. data/README.md +187 -52
  4. data/lib/generators/rodauth/install_generator.rb +28 -20
  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 +4 -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 +98 -30
  34. data/lib/rodauth/rails/railtie.rb +11 -0
  35. data/lib/rodauth/rails/tasks.rake +28 -0
  36. data/lib/rodauth/rails/version.rb +1 -1
  37. data/rodauth-rails.gemspec +3 -3
  38. metadata +29 -7
@@ -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
@@ -13,6 +15,15 @@ module Rodauth
13
15
  include Rodauth::Rails::ControllerMethods
14
16
  end
15
17
  end
18
+
19
+ initializer "rodauth.test" do
20
+ # Rodauth uses RACK_ENV to set the default bcrypt hash cost
21
+ ENV["RACK_ENV"] = "test" if ::Rails.env.test?
22
+ end
23
+
24
+ rake_tasks do
25
+ load "rodauth/rails/tasks.rake"
26
+ end
16
27
  end
17
28
  end
18
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.1"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
@@ -11,14 +11,14 @@ Gem::Specification.new do |spec|
11
11
  spec.homepage = "https://github.com/janko/rodauth-rails"
12
12
  spec.license = "MIT"
13
13
 
14
- spec.required_ruby_version = ">= 2.2.0"
14
+ spec.required_ruby_version = ">= 2.3"
15
15
 
16
16
  spec.files = Dir["README.md", "LICENSE.txt", "CHANGELOG.md", "lib/**/*", "*.gemspec"]
17
17
  spec.require_paths = ["lib"]
18
18
 
19
19
  spec.add_dependency "railties", ">= 4.2", "< 7"
20
- spec.add_dependency "rodauth", "~> 2.1"
21
- spec.add_dependency "sequel-activerecord_connection", "~> 1.0"
20
+ spec.add_dependency "rodauth", "~> 2.6"
21
+ spec.add_dependency "sequel-activerecord_connection", "~> 1.1"
22
22
  spec.add_dependency "tilt"
23
23
  spec.add_dependency "bcrypt"
24
24
  end
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.1
4
+ version: 0.7.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-02 00:00:00.000000000 Z
11
+ date: 2020-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -36,28 +36,28 @@ dependencies:
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.1'
39
+ version: '2.6'
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.6'
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sequel-activerecord_connection
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: '1.0'
53
+ version: '1.1'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: '1.0'
60
+ version: '1.1'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: tilt
63
63
  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
@@ -171,10 +191,12 @@ files:
171
191
  - lib/rodauth/rails.rb
172
192
  - lib/rodauth/rails/app.rb
173
193
  - lib/rodauth/rails/app/flash.rb
194
+ - lib/rodauth/rails/app/middleware.rb
174
195
  - lib/rodauth/rails/controller_methods.rb
175
196
  - lib/rodauth/rails/feature.rb
176
197
  - lib/rodauth/rails/middleware.rb
177
198
  - lib/rodauth/rails/railtie.rb
199
+ - lib/rodauth/rails/tasks.rake
178
200
  - lib/rodauth/rails/version.rb
179
201
  - rodauth-rails.gemspec
180
202
  homepage: https://github.com/janko/rodauth-rails
@@ -189,7 +211,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
189
211
  requirements:
190
212
  - - ">="
191
213
  - !ruby/object:Gem::Version
192
- version: 2.2.0
214
+ version: '2.3'
193
215
  required_rubygems_version: !ruby/object:Gem::Requirement
194
216
  requirements:
195
217
  - - ">="