rails_base 0.54.0 → 0.58.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 +4 -4
- data/app/helpers/rails_base/admin_helper.rb +3 -0
- data/app/services/rails_base/authentication/send_verification_email.rb +11 -4
- data/app/views/layouts/rails_base/application.html.erb +1 -1
- data/app/views/rails_base/email_verification_mailer/email_verification.html.erb +3 -1
- data/app/views/rails_base/shared/_admin_config_class.html.erb +1 -1
- data/app/views/rails_base/shared/_logged_in_header.html.erb +9 -1
- data/lib/rails_base/config.rb +3 -1
- data/lib/rails_base/configuration/login_behavior.rb +11 -1
- data/lib/rails_base/configuration/mailer.rb +6 -1
- data/lib/rails_base/configuration/templates.rb +18 -0
- data/lib/rails_base/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0d56cf778690b03f6e04404f07f6b9c428406249adcf80f61dab8a0f16894b1
|
4
|
+
data.tar.gz: 553c0ebb31fa6f0cad2c715edd210fb9bfd71ef908ea25f9e8f753f7faa8bbf2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 867ba0f4c94b2e13ffe63bfff7ca8dd7f4414250c42a3a3ce31bf3599dbc7d53e39028e2a79ddd44990028b51065e8249d3da926a487eddf13a0a3855c1ac7a0
|
7
|
+
data.tar.gz: 35103b3f631bb8959892cda6cd6bbe15503e2e3b5c2381b372bc0e00e1525607efc43495d4b989a827158c783abb4daba216b218bc5343fe83c6d2219a8dfe4c
|
@@ -8,15 +8,22 @@ module RailsBase::Authentication
|
|
8
8
|
delegate :user, to: :context
|
9
9
|
delegate :reason, to: :context
|
10
10
|
|
11
|
-
MAX_USE_COUNT = 1.freeze
|
12
11
|
DATA_USE = :alphanumeric
|
13
12
|
VELOCITY_MAX = 5
|
14
13
|
VELOCITY_MAX_IN_FRAME = 10.minutes
|
15
14
|
VELOCITY_FRAME = 1.hour
|
16
15
|
|
17
16
|
REASON_MAPPER = {
|
18
|
-
Constants::SVE_LOGIN_REASON => {
|
19
|
-
|
17
|
+
Constants::SVE_LOGIN_REASON => {
|
18
|
+
method: :email_verification,
|
19
|
+
url_method: :email_verification_url,
|
20
|
+
max_use: RailsBase.config.login_behavior.email_max_use_verification
|
21
|
+
},
|
22
|
+
Constants::SVE_FORGOT_REASON => {
|
23
|
+
method: :forgot_password,
|
24
|
+
url_method: :forgot_password_auth_url,
|
25
|
+
max_use: RailsBase.config.login_behavior.email_max_use_forgot
|
26
|
+
}
|
20
27
|
}
|
21
28
|
|
22
29
|
def call
|
@@ -61,7 +68,7 @@ module RailsBase::Authentication
|
|
61
68
|
def create_short_lived_data
|
62
69
|
params = {
|
63
70
|
user: user,
|
64
|
-
max_use:
|
71
|
+
max_use: REASON_MAPPER[reason][:max_use],
|
65
72
|
reason: reason,
|
66
73
|
data_use: DATA_USE,
|
67
74
|
ttl: Constants::SVE_TTL,
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<p>Hello <%= @user.full_name %>!</p>
|
2
2
|
|
3
3
|
<p>
|
4
|
-
Welcome to <%= RailsBase.config.app.communication_name %>.
|
4
|
+
Welcome to <%= RailsBase.config.app.communication_name %>.
|
5
|
+
</br>
|
6
|
+
<%= RailsBase.config.mailer.verification_content(@user) %>
|
5
7
|
</br>
|
6
8
|
Please finish your registration by following this <a href="<%=@sso_url_for_user%>" target="_blank"> Registration Link </a>
|
7
9
|
</br>
|
@@ -14,7 +14,7 @@
|
|
14
14
|
<% case object[:type] %>
|
15
15
|
<% when :proc %>
|
16
16
|
<td>
|
17
|
-
<% users = users_for_proc(instance.public_send(name)) %>
|
17
|
+
<% users = users_for_proc(instance.public_send(name)) || ['Yikes! Probably a proc with different values'] %>
|
18
18
|
<a tabindex="0" class="btn btn_secondary" role="button" data-toggle="popover" data-trigger="focus" title="Users with ability" data-html=true data-content="<%=users.join('</br>')%>">View Users</a>
|
19
19
|
</td>
|
20
20
|
<% when :string_proc %>
|
@@ -59,7 +59,7 @@
|
|
59
59
|
</br>
|
60
60
|
<div class='row'>
|
61
61
|
<div class='col'>
|
62
|
-
<a class="btn btn_info btn-block" href="<%=RailsBase.url_routes.user_settings_path%>" role="button">Modify User</a>
|
62
|
+
<a class="btn btn_info btn-block" href="<%=RailsBase.url_routes.user_settings_path %>" role="button">Modify User</a>
|
63
63
|
</div>
|
64
64
|
</div>
|
65
65
|
</br>
|
@@ -69,6 +69,14 @@
|
|
69
69
|
</div>
|
70
70
|
</div>
|
71
71
|
</br>
|
72
|
+
<% if RailsBase.config.templates.logged_in_header_modal %>
|
73
|
+
<div class='row'>
|
74
|
+
<div class='col'>
|
75
|
+
<%= render partial: RailsBase.config.templates.logged_in_header_modal, locals: { current_user: current_user } %>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
</br>
|
79
|
+
<% end %>
|
72
80
|
<div class="dropdown-divider"></div>
|
73
81
|
<div class='row'>
|
74
82
|
<div class='col'>
|
data/lib/rails_base/config.rb
CHANGED
@@ -11,6 +11,7 @@ require 'rails_base/configuration/appearance'
|
|
11
11
|
require 'rails_base/configuration/user'
|
12
12
|
require 'rails_base/configuration/login_behavior'
|
13
13
|
require 'rails_base/configuration/active_job'
|
14
|
+
require 'rails_base/configuration/templates'
|
14
15
|
|
15
16
|
module RailsBase
|
16
17
|
class Config
|
@@ -28,7 +29,8 @@ module RailsBase
|
|
28
29
|
appearance: nil,
|
29
30
|
user: nil,
|
30
31
|
active_job: nil,
|
31
|
-
login_behavior: nil
|
32
|
+
login_behavior: nil,
|
33
|
+
templates: nil,
|
32
34
|
}
|
33
35
|
attr_reader *VARIABLES.keys
|
34
36
|
|
@@ -9,7 +9,17 @@ module RailsBase
|
|
9
9
|
type: :boolean,
|
10
10
|
default: true,
|
11
11
|
description: 'Enable capturing requests context when login fails. Upon login, redirect user to page they tried to go to.',
|
12
|
-
}
|
12
|
+
},
|
13
|
+
email_max_use_verification:{
|
14
|
+
type: :integer,
|
15
|
+
default: 2,
|
16
|
+
description: 'Maximum number of times User can click link for verifiaction',
|
17
|
+
},
|
18
|
+
email_max_use_forgot:{
|
19
|
+
type: :integer,
|
20
|
+
default: 2,
|
21
|
+
description: 'Maximum number of times User can click link for forgot password flow',
|
22
|
+
},
|
13
23
|
}
|
14
24
|
attr_accessor *DEFAULT_VALUES.keys
|
15
25
|
end
|
@@ -107,7 +107,12 @@ module RailsBase
|
|
107
107
|
default: 'mailers',
|
108
108
|
on_assignment: ->(val, _instance) { ACTION_MAILER_PROC.call(:deliver_later_queue_name, val) },
|
109
109
|
description: 'The active job queue to send twilio messages from. Ensure that adapter is bound to the queue',
|
110
|
-
}
|
110
|
+
},
|
111
|
+
verification_content: {
|
112
|
+
type: :string_proc,
|
113
|
+
default: ->(user) { "We are pleased to have you here" },
|
114
|
+
description: 'Description of app for verification mailer. User is passed in.',
|
115
|
+
},
|
111
116
|
}
|
112
117
|
|
113
118
|
attr_accessor *DEFAULT_VALUES.keys
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class Templates < Base
|
6
|
+
|
7
|
+
DEFAULT_VALUES = {
|
8
|
+
logged_in_header_modal: {
|
9
|
+
type: :string_nil,
|
10
|
+
default: nil,
|
11
|
+
description: 'The template to render in the logged in header modal. `current_user` is passed in',
|
12
|
+
},
|
13
|
+
}
|
14
|
+
|
15
|
+
attr_accessor *DEFAULT_VALUES.keys
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/lib/rails_base/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_base
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.58.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -590,6 +590,7 @@ files:
|
|
590
590
|
- lib/rails_base/configuration/mfa.rb
|
591
591
|
- lib/rails_base/configuration/owner.rb
|
592
592
|
- lib/rails_base/configuration/redis.rb
|
593
|
+
- lib/rails_base/configuration/templates.rb
|
593
594
|
- lib/rails_base/configuration/user.rb
|
594
595
|
- lib/rails_base/engine.rb
|
595
596
|
- lib/rails_base/version.rb
|