rodauth-rails 1.5.1 → 1.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +13 -12
- data/lib/generators/rodauth/install_generator.rb +7 -0
- data/lib/generators/rodauth/templates/app/test/fixtures/accounts.yml +10 -0
- data/lib/rodauth/rails/app.rb +6 -0
- data/lib/rodauth/rails/feature/instrumentation.rb +1 -1
- data/lib/rodauth/rails/tasks.rake +19 -5
- data/lib/rodauth/rails/version.rb +1 -1
- data/rodauth-rails.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d36f5274c33c95aab970521c38b77e9ac47242cc248e181f122b8ef518e5017
|
4
|
+
data.tar.gz: d52e7ec12ebde869a023d6123b5550b061bb4210bc44bd4f4fa8200e592cf94d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8162dd61a98976e3b06d6cee8575197f284e3415c8edcfa30ceed005fbedfe18f3d1c739253ce967434c35dc1ce01b246bd535069daaec92d71c807f2c91ac5
|
7
|
+
data.tar.gz: cb6fe07c7cdb2a7d310ec1dcd60f35170fc478230b33d8cb193797b4db824c519ac4f2de588ff2f176ca96b7746ea7573a116e4497436eccaa640f073c8927ac
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## 1.5.2 (2022-07-03)
|
2
|
+
|
3
|
+
* Bump Rodauth dependency version to 2.25+ (@janko)
|
4
|
+
|
5
|
+
* Generate fixture file for accounts on `rodauth:install` (@benkoshy)
|
6
|
+
|
7
|
+
* Fix error about undefined `controller_path` method in `newrelic_rpm` gem instrumentation (@janko)
|
8
|
+
|
9
|
+
* Don't display disabled routes in `rodauth:routes` (@janko)
|
10
|
+
|
11
|
+
* Display HTTP verbs of endpoints in `rodauth:routes` rake task (@janko)
|
12
|
+
|
1
13
|
## 1.5.1 (2022-06-19)
|
2
14
|
|
3
15
|
* Fix syntax for creating `citext` PG extension in Sequel base migration (@Empact)
|
data/README.md
CHANGED
@@ -110,18 +110,18 @@ $ rails rodauth:routes
|
|
110
110
|
```
|
111
111
|
Routes handled by RodauthApp:
|
112
112
|
|
113
|
-
/login rodauth.login_path
|
114
|
-
/create-account rodauth.create_account_path
|
115
|
-
/verify-account-resend rodauth.verify_account_resend_path
|
116
|
-
/verify-account rodauth.verify_account_path
|
117
|
-
/change-password rodauth.change_password_path
|
118
|
-
/change-login rodauth.change_login_path
|
119
|
-
/logout rodauth.logout_path
|
120
|
-
/remember rodauth.remember_path
|
121
|
-
/reset-password-request rodauth.reset_password_request_path
|
122
|
-
/reset-password rodauth.reset_password_path
|
123
|
-
/verify-login-change rodauth.verify_login_change_path
|
124
|
-
/close-account rodauth.close_account_path
|
113
|
+
GET/POST /login rodauth.login_path
|
114
|
+
GET/POST /create-account rodauth.create_account_path
|
115
|
+
GET/POST /verify-account-resend rodauth.verify_account_resend_path
|
116
|
+
GET/POST /verify-account rodauth.verify_account_path
|
117
|
+
GET/POST /change-password rodauth.change_password_path
|
118
|
+
GET/POST /change-login rodauth.change_login_path
|
119
|
+
GET/POST /logout rodauth.logout_path
|
120
|
+
GET/POST /remember rodauth.remember_path
|
121
|
+
GET/POST /reset-password-request rodauth.reset_password_request_path
|
122
|
+
GET/POST /reset-password rodauth.reset_password_path
|
123
|
+
GET/POST /verify-login-change rodauth.verify_login_change_path
|
124
|
+
GET/POST /close-account rodauth.close_account_path
|
125
125
|
```
|
126
126
|
|
127
127
|
Using this information, you can add some basic authentication links to your
|
@@ -381,6 +381,7 @@ class RodauthController < ApplicationController
|
|
381
381
|
when rodauth.login_path,
|
382
382
|
rodauth.create_account_path,
|
383
383
|
rodauth.verify_account_path,
|
384
|
+
rodauth.verify_account_resend_path,
|
384
385
|
rodauth.reset_password_path,
|
385
386
|
rodauth.reset_password_request_path
|
386
387
|
"authentication"
|
@@ -70,6 +70,13 @@ module Rodauth
|
|
70
70
|
end
|
71
71
|
end
|
72
72
|
|
73
|
+
def create_fixtures
|
74
|
+
test_unit_options = ::Rails.application.config.generators.options[:test_unit]
|
75
|
+
if test_unit_options[:fixture] && test_unit_options[:fixture_replacement].nil?
|
76
|
+
template "app/test/fixtures/accounts.yml"
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
73
80
|
def show_instructions
|
74
81
|
readme "INSTRUCTIONS" if behavior == :invoke
|
75
82
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# Read about fixtures at https://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
2
|
+
one:
|
3
|
+
email: freddie@queen.com
|
4
|
+
password_hash: <%%= BCrypt::Password.create("password", cost: BCrypt::Engine::MIN_COST) %>
|
5
|
+
status: 2
|
6
|
+
|
7
|
+
two:
|
8
|
+
email: brian@queen.com
|
9
|
+
password_hash: <%%= BCrypt::Password.create("password", cost: BCrypt::Engine::MIN_COST) %>
|
10
|
+
status: 2
|
data/lib/rodauth/rails/app.rb
CHANGED
@@ -59,6 +59,12 @@ module Rodauth
|
|
59
59
|
rodauth(name) or fail ArgumentError, "unknown rodauth configuration: #{name.inspect}"
|
60
60
|
end
|
61
61
|
|
62
|
+
# The newrelic_rpm gem expects this when we pass the roda class as
|
63
|
+
# :controller in instrumentation payload.
|
64
|
+
def self.controller_path
|
65
|
+
name.underscore
|
66
|
+
end
|
67
|
+
|
62
68
|
module RequestMethods
|
63
69
|
def rodauth(name = nil)
|
64
70
|
prefix = scope.rodauth(name).prefix
|
@@ -6,20 +6,34 @@ namespace :rodauth do
|
|
6
6
|
|
7
7
|
app.opts[:rodauths].each do |configuration_name, auth_class|
|
8
8
|
rodauth = auth_class.allocate
|
9
|
+
only_json = rodauth.method(:only_json?).owner != Rodauth::Base && rodauth.only_json?
|
10
|
+
|
11
|
+
routes = auth_class.route_hash.map do |path, handle_method|
|
12
|
+
file_path, start_line = rodauth.method(:"_#{handle_method}").source_location
|
13
|
+
lines = File.foreach(file_path).to_a
|
14
|
+
indentation = lines[start_line - 1][/^\s+/]
|
15
|
+
verbs = []
|
16
|
+
|
17
|
+
lines[start_line..-1].each do |code|
|
18
|
+
verbs << :GET if code.include?("r.get") && !only_json
|
19
|
+
verbs << :POST if code.include?("r.post")
|
20
|
+
break if code.start_with?("#{indentation}end")
|
21
|
+
end
|
9
22
|
|
10
|
-
routes = auth_class.routes.map do |handle_method|
|
11
23
|
path_method = "#{handle_method.to_s.sub(/\Ahandle_/, "")}_path"
|
12
24
|
|
13
25
|
[
|
14
|
-
|
26
|
+
verbs.join("/"),
|
27
|
+
"#{rodauth.prefix}#{path}",
|
15
28
|
"rodauth#{configuration_name && "(:#{configuration_name})"}.#{path_method}",
|
16
29
|
]
|
17
30
|
end
|
18
31
|
|
19
|
-
|
32
|
+
verbs_padding = routes.map { |verbs, _, _| verbs.length }.max
|
33
|
+
path_padding = routes.map { |_, path, _| path.length }.max
|
20
34
|
|
21
|
-
route_lines = routes.map do |path, code|
|
22
|
-
"#{path.ljust(
|
35
|
+
route_lines = routes.map do |verbs, path, code|
|
36
|
+
"#{verbs.ljust(verbs_padding)} #{path.ljust(path_padding)} #{code}"
|
23
37
|
end
|
24
38
|
|
25
39
|
puts "\n #{route_lines.join("\n ")}" unless route_lines.empty?
|
data/rodauth-rails.gemspec
CHANGED
@@ -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", "< 8"
|
20
|
-
spec.add_dependency "rodauth", "~> 2.
|
20
|
+
spec.add_dependency "rodauth", "~> 2.25"
|
21
21
|
spec.add_dependency "roda", "~> 3.55"
|
22
22
|
spec.add_dependency "sequel-activerecord_connection", "~> 1.1"
|
23
23
|
spec.add_dependency "rodauth-model", "~> 0.2"
|
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: 1.5.
|
4
|
+
version: 1.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janko Marohnić
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-02 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.
|
39
|
+
version: '2.25'
|
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.
|
46
|
+
version: '2.25'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: roda
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -224,6 +224,7 @@ files:
|
|
224
224
|
- lib/generators/rodauth/templates/app/misc/rodauth_app.rb
|
225
225
|
- lib/generators/rodauth/templates/app/misc/rodauth_main.rb
|
226
226
|
- lib/generators/rodauth/templates/app/models/account.rb
|
227
|
+
- lib/generators/rodauth/templates/app/test/fixtures/accounts.yml
|
227
228
|
- lib/generators/rodauth/templates/app/views/rodauth/_email_auth_request_form.html.erb
|
228
229
|
- lib/generators/rodauth/templates/app/views/rodauth/_login_form.html.erb
|
229
230
|
- lib/generators/rodauth/templates/app/views/rodauth/_login_form_footer.html.erb
|