rails_base 0.51.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/MIT-LICENSE +20 -0
- data/README.md +32 -0
- data/Rakefile +32 -0
- data/app/assets/config/rails_base/manifest.js +3 -0
- data/app/assets/images/rails_base/favicon.ico +0 -0
- data/app/assets/javascripts/rails_base/admin.js +2 -0
- data/app/assets/javascripts/rails_base/application.js +22 -0
- data/app/assets/javascripts/rails_base/cable.js +13 -0
- data/app/assets/javascripts/rails_base/mfa_auth.coffee +3 -0
- data/app/assets/javascripts/rails_base/secondary_authentication.coffee +3 -0
- data/app/assets/javascripts/rails_base/sessions.js +152 -0
- data/app/assets/javascripts/rails_base/user_settings.coffee +3 -0
- data/app/assets/stylesheets/rails_base/admin.css +4 -0
- data/app/assets/stylesheets/rails_base/application.scss +15 -0
- data/app/assets/stylesheets/rails_base/mfa_auth.scss +3 -0
- data/app/assets/stylesheets/rails_base/scaffolds.scss +84 -0
- data/app/assets/stylesheets/rails_base/secondary_authentication.scss +3 -0
- data/app/assets/stylesheets/rails_base/user_settings.scss +3 -0
- data/app/controllers/rails_base/admin_controller.rb +315 -0
- data/app/controllers/rails_base/application_controller.rb +153 -0
- data/app/controllers/rails_base/errors_controller.rb +29 -0
- data/app/controllers/rails_base/mfa_auth_controller.rb +50 -0
- data/app/controllers/rails_base/secondary_authentication_controller.rb +224 -0
- data/app/controllers/rails_base/switch_user_controller.rb +29 -0
- data/app/controllers/rails_base/user_settings_controller.rb +81 -0
- data/app/controllers/rails_base/users/passwords_controller.rb +19 -0
- data/app/controllers/rails_base/users/registrations_controller.rb +80 -0
- data/app/controllers/rails_base/users/sessions_controller.rb +108 -0
- data/app/helpers/rails_base/admin_helper.rb +107 -0
- data/app/helpers/rails_base/appearance_helper.rb +58 -0
- data/app/helpers/rails_base/application_helper.rb +26 -0
- data/app/helpers/rails_base/capture_reference_helper.rb +57 -0
- data/app/helpers/rails_base/mfa_auth_helper.rb +2 -0
- data/app/helpers/rails_base/secondary_authentication_helper.rb +2 -0
- data/app/helpers/rails_base/user_field_validators.rb +108 -0
- data/app/helpers/rails_base/user_settings_helper.rb +22 -0
- data/app/jobs/rails_base/application_job.rb +10 -0
- data/app/jobs/twilio_job.rb +9 -0
- data/app/mailers/rails_base/application_mailer.rb +9 -0
- data/app/mailers/rails_base/email_verification_mailer.rb +22 -0
- data/app/mailers/rails_base/event_mailer.rb +16 -0
- data/app/models/admin_action.rb +119 -0
- data/app/models/rails_base/application_record.rb +22 -0
- data/app/models/rails_base/user_constants.rb +28 -0
- data/app/models/secret.rb +37 -0
- data/app/models/short_lived_data.rb +132 -0
- data/app/models/user.rb +143 -0
- data/app/services/rails_base/admin_risky_mfa_send.rb +80 -0
- data/app/services/rails_base/admin_update_attribute.rb +100 -0
- data/app/services/rails_base/authentication/authenticate_user.rb +28 -0
- data/app/services/rails_base/authentication/constants.rb +60 -0
- data/app/services/rails_base/authentication/decision_twofa_type.rb +76 -0
- data/app/services/rails_base/authentication/destroy_user.rb +45 -0
- data/app/services/rails_base/authentication/mfa_set_encrypt_token.rb +32 -0
- data/app/services/rails_base/authentication/mfa_validator.rb +88 -0
- data/app/services/rails_base/authentication/modify_password.rb +67 -0
- data/app/services/rails_base/authentication/send_forgot_password.rb +26 -0
- data/app/services/rails_base/authentication/send_login_mfa_to_user.rb +77 -0
- data/app/services/rails_base/authentication/send_verification_email.rb +103 -0
- data/app/services/rails_base/authentication/session_token_verifier.rb +31 -0
- data/app/services/rails_base/authentication/single_sign_on_create.rb +44 -0
- data/app/services/rails_base/authentication/single_sign_on_send.rb +101 -0
- data/app/services/rails_base/authentication/single_sign_on_verify.rb +42 -0
- data/app/services/rails_base/authentication/sso_verify_email.rb +43 -0
- data/app/services/rails_base/authentication/update_phone_send_verification.rb +46 -0
- data/app/services/rails_base/authentication/verify_forgot_password.rb +46 -0
- data/app/services/rails_base/email_change.rb +20 -0
- data/app/services/rails_base/encryption.rb +87 -0
- data/app/services/rails_base/name_change.rb +71 -0
- data/app/services/rails_base/service_base.rb +65 -0
- data/app/services/rails_base/service_logging.rb +23 -0
- data/app/views/layouts/rails_base/application.html.erb +185 -0
- data/app/views/layouts/rails_base/mailer.html.erb +13 -0
- data/app/views/layouts/rails_base/mailer.text.erb +1 -0
- data/app/views/new.html.erb +4 -0
- data/app/views/rails_base/admin/history.html.erb +26 -0
- data/app/views/rails_base/admin/index.html.erb +149 -0
- data/app/views/rails_base/admin/show_config.html.erb +18 -0
- data/app/views/rails_base/devise/confirmations/new.html.erb +16 -0
- data/app/views/rails_base/devise/mailer/confirmation_instructions.html.erb +5 -0
- data/app/views/rails_base/devise/mailer/email_changed.html.erb +7 -0
- data/app/views/rails_base/devise/mailer/password_change.html.erb +3 -0
- data/app/views/rails_base/devise/mailer/reset_password_instructions.html.erb +8 -0
- data/app/views/rails_base/devise/mailer/unlock_instructions.html.erb +7 -0
- data/app/views/rails_base/devise/passwords/edit.html.erb +25 -0
- data/app/views/rails_base/devise/passwords/new.html.erb +27 -0
- data/app/views/rails_base/devise/registrations/edit.html.erb +43 -0
- data/app/views/rails_base/devise/registrations/new.html.erb +123 -0
- data/app/views/rails_base/devise/sessions/new.html.erb +4 -0
- data/app/views/rails_base/devise/shared/_error_messages.html.erb +15 -0
- data/app/views/rails_base/devise/shared/_links.html.erb +25 -0
- data/app/views/rails_base/devise/unlocks/new.html.erb +16 -0
- data/app/views/rails_base/email_verification_mailer/email_verification.html.erb +25 -0
- data/app/views/rails_base/email_verification_mailer/event.html.erb +20 -0
- data/app/views/rails_base/email_verification_mailer/forgot_password.html.erb +22 -0
- data/app/views/rails_base/errors/internal_error.html.erb +1 -0
- data/app/views/rails_base/errors/not_found.html.erb +1 -0
- data/app/views/rails_base/errors/unacceptable.html.erb +1 -0
- data/app/views/rails_base/event_mailer/event.html.erb +10 -0
- data/app/views/rails_base/mfa_auth/mfa_code.html.erb +10 -0
- data/app/views/rails_base/secondary_authentication/after_email_login_session_new.html.erb +3 -0
- data/app/views/rails_base/secondary_authentication/forgot_password.html.erb +9 -0
- data/app/views/rails_base/secondary_authentication/remove_me.html.erb +1 -0
- data/app/views/rails_base/secondary_authentication/static.html.erb +5 -0
- data/app/views/rails_base/shared/_admin_actions_modal.html.erb +65 -0
- data/app/views/rails_base/shared/_admin_config_class.html.erb +52 -0
- data/app/views/rails_base/shared/_admin_history.html.erb +86 -0
- data/app/views/rails_base/shared/_admin_modify_email.html.erb +78 -0
- data/app/views/rails_base/shared/_admin_modify_name.html.erb +107 -0
- data/app/views/rails_base/shared/_admin_modify_phone.html.erb +87 -0
- data/app/views/rails_base/shared/_admin_modify_text.html.erb +35 -0
- data/app/views/rails_base/shared/_admin_risky_change.html.erb +57 -0
- data/app/views/rails_base/shared/_admin_risky_mfa.html.erb +74 -0
- data/app/views/rails_base/shared/_admin_selector_dropdown.html.erb +70 -0
- data/app/views/rails_base/shared/_admin_toggle_button.html.erb +72 -0
- data/app/views/rails_base/shared/_admin_warning_alert.html.erb +7 -0
- data/app/views/rails_base/shared/_appearance_mode_selector.html.erb +183 -0
- data/app/views/rails_base/shared/_custom_form_validation_javascript.html.erb +129 -0
- data/app/views/rails_base/shared/_enable_mfa_auth_modal.html.erb +105 -0
- data/app/views/rails_base/shared/_error_pages.html.erb +123 -0
- data/app/views/rails_base/shared/_logged_in_header.html.erb +123 -0
- data/app/views/rails_base/shared/_logged_out_header.html.erb +14 -0
- data/app/views/rails_base/shared/_mfa_input_layout.html.erb +5 -0
- data/app/views/rails_base/shared/_mfa_input_layout_default.html.erb +97 -0
- data/app/views/rails_base/shared/_mfa_input_layout_fallback.html.erb +55 -0
- data/app/views/rails_base/shared/_modify_mfa_auth_modal.html.erb +20 -0
- data/app/views/rails_base/shared/_password_confirm_javascript.html.erb +71 -0
- data/app/views/rails_base/shared/_reset_password_form.html.erb +111 -0
- data/app/views/rails_base/shared/_session_create_form.html.erb +32 -0
- data/app/views/rails_base/shared/_session_timeout_modal.html.erb +76 -0
- data/app/views/rails_base/switch_user/_widget.html.erb +5 -0
- data/app/views/rails_base/user_settings/_confirm_destroy_user.html.erb +42 -0
- data/app/views/rails_base/user_settings/_destroy_user.html.erb +106 -0
- data/app/views/rails_base/user_settings/_modify_name.html.erb +71 -0
- data/app/views/rails_base/user_settings/_modify_password.html.erb +101 -0
- data/app/views/rails_base/user_settings/_modify_password_update_password.html.erb +2 -0
- data/app/views/rails_base/user_settings/index.html.erb +54 -0
- data/config/initializers/01_rails_config.rb +19 -0
- data/config/initializers/admin_action_helper.rb +88 -0
- data/config/initializers/browser.rb +4 -0
- data/config/initializers/default_logged_in_headers.rb +23 -0
- data/config/initializers/devise.rb +314 -0
- data/config/initializers/encryption.rb +2 -0
- data/config/initializers/switch_user.rb +58 -0
- data/config/initializers/switch_user_helper.rb +29 -0
- data/config/locales/devise.en.yml +65 -0
- data/config/locales/en.yml +58 -0
- data/config/routes.rb +114 -0
- data/db/migrate/20210212175453_devise_create_rails_base_users.rb +56 -0
- data/db/migrate/20210212190537_create_rails_base_short_lived_data.rb +19 -0
- data/db/migrate/20210212192645_create_rails_base_secrets.rb +11 -0
- data/db/migrate/20210406015744_create_rails_base_admin_actions.rb +17 -0
- data/db/seeds.rb +23 -0
- data/lib/link_decision_helper.rb +71 -0
- data/lib/rails_base.rb +50 -0
- data/lib/rails_base/admin/action_cache.rb +99 -0
- data/lib/rails_base/admin/action_helper.rb +134 -0
- data/lib/rails_base/admin/default_index_tile.rb +176 -0
- data/lib/rails_base/admin/index_tile.rb +186 -0
- data/lib/rails_base/config.rb +52 -0
- data/lib/rails_base/configuration/active_job.rb +38 -0
- data/lib/rails_base/configuration/admin.rb +231 -0
- data/lib/rails_base/configuration/app.rb +52 -0
- data/lib/rails_base/configuration/appearance.rb +131 -0
- data/lib/rails_base/configuration/authentication.rb +37 -0
- data/lib/rails_base/configuration/base.rb +209 -0
- data/lib/rails_base/configuration/display/background_color.rb +25 -0
- data/lib/rails_base/configuration/display/btn_danger.rb +25 -0
- data/lib/rails_base/configuration/display/btn_dark.rb +25 -0
- data/lib/rails_base/configuration/display/btn_info.rb +25 -0
- data/lib/rails_base/configuration/display/btn_light.rb +25 -0
- data/lib/rails_base/configuration/display/btn_primary.rb +25 -0
- data/lib/rails_base/configuration/display/btn_secondary.rb +25 -0
- data/lib/rails_base/configuration/display/btn_success.rb +25 -0
- data/lib/rails_base/configuration/display/btn_warning.rb +25 -0
- data/lib/rails_base/configuration/display/footer.rb +54 -0
- data/lib/rails_base/configuration/display/navbar.rb +25 -0
- data/lib/rails_base/configuration/display/table_body.rb +25 -0
- data/lib/rails_base/configuration/display/table_header.rb +25 -0
- data/lib/rails_base/configuration/display/text.rb +26 -0
- data/lib/rails_base/configuration/exceptions_app.rb +25 -0
- data/lib/rails_base/configuration/login_behavior.rb +17 -0
- data/lib/rails_base/configuration/mailer.rb +116 -0
- data/lib/rails_base/configuration/mfa.rb +84 -0
- data/lib/rails_base/configuration/owner.rb +17 -0
- data/lib/rails_base/configuration/redis.rb +29 -0
- data/lib/rails_base/configuration/user.rb +43 -0
- data/lib/rails_base/engine.rb +51 -0
- data/lib/rails_base/version.rb +10 -0
- data/lib/tasks/rails_base_tasks.rake +4 -0
- data/lib/twilio_helper.rb +26 -0
- data/lib/velocity_limiter.rb +91 -0
- metadata +619 -0
@@ -0,0 +1,84 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class Mfa < Base
|
6
|
+
MFA_MIN_LENGTH = 4
|
7
|
+
MFA_MAX_LENGTH = 8
|
8
|
+
DEFAULT_VALUES = {
|
9
|
+
enable: {
|
10
|
+
type: :boolean,
|
11
|
+
default: ENV.fetch('MFA_ENABLE', 'true')=='true',
|
12
|
+
description: 'Enable MFA and SMS verification. When not enabled, there are some interesting consequences',
|
13
|
+
},
|
14
|
+
mfa_length: {
|
15
|
+
type: :integer,
|
16
|
+
default: 5,
|
17
|
+
custom: ->(val) { val > MFA_MIN_LENGTH && val < MFA_MAX_LENGTH },
|
18
|
+
msg: "Must be an integer greater than #{MFA_MIN_LENGTH} and less than #{MFA_MAX_LENGTH}",
|
19
|
+
description: 'Length of MFA verification',
|
20
|
+
},
|
21
|
+
twilio_sid: {
|
22
|
+
type: :string,
|
23
|
+
default: ENV.fetch('TWILIO_ACCOUNT_SID',''),
|
24
|
+
secret: true,
|
25
|
+
description: 'Twilio SID',
|
26
|
+
},
|
27
|
+
twilio_auth_token: {
|
28
|
+
type: :string,
|
29
|
+
default: ENV.fetch('TWILIO_AUTH_TOKEN', ''),
|
30
|
+
secret: true,
|
31
|
+
description: 'Twilio Auth Token',
|
32
|
+
},
|
33
|
+
twilio_from_number: {
|
34
|
+
type: :string,
|
35
|
+
default: ENV.fetch('TWILIO_FROM_NUMBER', ''),
|
36
|
+
description: 'Number that we send MFA\'s From',
|
37
|
+
},
|
38
|
+
twilio_velocity_max: {
|
39
|
+
type: :integer,
|
40
|
+
default: ENV.fetch('TWILIO_VELOCITY_MAX', 5).to_i,
|
41
|
+
description: 'Max number of SMS we send to a user in a sliding window',
|
42
|
+
|
43
|
+
},
|
44
|
+
twilio_velocity_max_in_frame: {
|
45
|
+
type: :duration,
|
46
|
+
default: ENV.fetch('TWILIO_VELOCITY_MAX_IN_FRAME', 1).to_i.hours,
|
47
|
+
description: 'Sliding window for twilio_velocity_max',
|
48
|
+
},
|
49
|
+
twilio_velocity_frame: {
|
50
|
+
type: :duration,
|
51
|
+
default: ENV.fetch('TWILIO_VELOCITY_FRAME', 5).to_i.hours,
|
52
|
+
description: 'Debug purposes. How long to keep admin_velocity_max attempts',
|
53
|
+
},
|
54
|
+
active_job_queue: {
|
55
|
+
type: :string,
|
56
|
+
default: 'twilio_sms',
|
57
|
+
description: 'The active job queue to send twilio messages from. Ensure that adapter is bound to the queue',
|
58
|
+
}
|
59
|
+
}
|
60
|
+
|
61
|
+
attr_accessor *DEFAULT_VALUES.keys
|
62
|
+
|
63
|
+
private
|
64
|
+
|
65
|
+
def custom_validations
|
66
|
+
enforce_twilio!
|
67
|
+
end
|
68
|
+
|
69
|
+
def enforce_twilio!
|
70
|
+
return unless enable == true
|
71
|
+
|
72
|
+
return if twilio_sid.present? &&
|
73
|
+
twilio_auth_token.present? &&
|
74
|
+
twilio_from_number.present?
|
75
|
+
|
76
|
+
raise InvalidConfiguration, "twilio_sid twilio_auth_token twilio_from_number need to be present when `mfa.enabled`"
|
77
|
+
end
|
78
|
+
|
79
|
+
def default_values
|
80
|
+
DEFAULT_VALUES
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class Owner < Base
|
6
|
+
DEFAULT_VALUES = {
|
7
|
+
max: {
|
8
|
+
type: :integer,
|
9
|
+
default: 1,
|
10
|
+
description: 'Max number of Repo Admins'
|
11
|
+
}
|
12
|
+
}
|
13
|
+
|
14
|
+
attr_accessor *DEFAULT_VALUES.keys
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class Redis < Base
|
6
|
+
URL_PROC = Proc.new do |val|
|
7
|
+
redacted_uri = URI(val)
|
8
|
+
redacted_uri.user = nil
|
9
|
+
redacted_uri.password = nil
|
10
|
+
redacted_uri
|
11
|
+
end
|
12
|
+
DEFAULT_VALUES = {
|
13
|
+
admin_action: {
|
14
|
+
type: :string,
|
15
|
+
default: ENV.fetch('REDIS_URL',''),
|
16
|
+
decipher: URL_PROC,
|
17
|
+
description: 'Redis URL for Admin cache'
|
18
|
+
},
|
19
|
+
admin_action_namespace: {
|
20
|
+
type: :string_nil,
|
21
|
+
default: nil,
|
22
|
+
description: 'Namespace used for admin cache'
|
23
|
+
},
|
24
|
+
}
|
25
|
+
|
26
|
+
attr_accessor *DEFAULT_VALUES.keys
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rails_base/configuration/base'
|
2
|
+
|
3
|
+
module RailsBase
|
4
|
+
module Configuration
|
5
|
+
class User < Base
|
6
|
+
USER_DEFINED_KEY = 'User Defined Zone'
|
7
|
+
USER_DEFINED_ZONE = { USER_DEFINED_KEY => ->(user) { user.last_known_timezone } }
|
8
|
+
ACTIVE_SUPPORT_MAPPING = ActiveSupport::TimeZone::MAPPING.map do |key, value|
|
9
|
+
[key, ->(*) { value }]
|
10
|
+
end.to_h
|
11
|
+
|
12
|
+
DEFAULT_TIMEZONES = {
|
13
|
+
'' => ->(*) { ActiveSupport::TimeZone::MAPPING['UTC'] },
|
14
|
+
nil => ->(*) { ActiveSupport::TimeZone::MAPPING['UTC'] },
|
15
|
+
}
|
16
|
+
|
17
|
+
ACCEPTED_TIMEZONES = DEFAULT_TIMEZONES.merge(ACTIVE_SUPPORT_MAPPING).merge(USER_DEFINED_ZONE)
|
18
|
+
|
19
|
+
DEFAULT_VALUES = {
|
20
|
+
timezone: {
|
21
|
+
type: :values,
|
22
|
+
default: USER_DEFINED_KEY,
|
23
|
+
description: 'The timezone to display to user.',
|
24
|
+
on_assignment: ->(val, instance) { instance._timezone_convenience },
|
25
|
+
expect_values: ACCEPTED_TIMEZONES.keys,
|
26
|
+
},
|
27
|
+
}
|
28
|
+
|
29
|
+
attr_accessor *DEFAULT_VALUES.keys
|
30
|
+
|
31
|
+
def _timezone_convenience
|
32
|
+
value = ACCEPTED_TIMEZONES[timezone]
|
33
|
+
self.class.define_method('user_timezone') do |user|
|
34
|
+
value.call(user) || ActiveSupport::TimeZone::MAPPING['UTC']
|
35
|
+
end
|
36
|
+
|
37
|
+
self.class.define_method('tz_user_defined?') do
|
38
|
+
timezone == USER_DEFINED_KEY
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module RailsBase
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace RailsBase
|
4
|
+
|
5
|
+
initializer 'instantiate RailsBase configs' do |_app|
|
6
|
+
RailsBase.config if ___execute_initializer___?
|
7
|
+
end
|
8
|
+
|
9
|
+
initializer 'remove write access to RailsBase config', after: 'after_initialize' do |app|
|
10
|
+
RailsBase::Configuration::Base._unset_allow_write! if ___execute_initializer___?
|
11
|
+
end
|
12
|
+
|
13
|
+
initializer 'define magic convenionce methods for converting team', after: 'active_record.initialize_database' do |app|
|
14
|
+
if ___execute_initializer___?
|
15
|
+
raise
|
16
|
+
# need to eager load Models
|
17
|
+
Rails.application.eager_load!
|
18
|
+
|
19
|
+
# create a connection
|
20
|
+
ActiveRecord::Base.retrieve_connection
|
21
|
+
|
22
|
+
#explicitly load engine routes
|
23
|
+
Dir.entries(RailsBase::Engine.root.join('app','models')).select{|s| s.ends_with?('.rb')}.each {|f| require f}
|
24
|
+
RailsBase::ApplicationRecord.descendants.each do |model|
|
25
|
+
model._magically_defined_time_objects
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
initializer 'remove switch_user routes', after: 'add_routing_paths' do |app|
|
31
|
+
app.routes_reloader.paths.delete_if{ |path| path.include?('switch_user') }
|
32
|
+
end
|
33
|
+
|
34
|
+
initializer 'append RailsBase engine migrations' do |app|
|
35
|
+
unless app.root.to_s.match root.to_s
|
36
|
+
config.paths["db/migrate"].expanded.each do |expanded_path|
|
37
|
+
app.config.paths["db/migrate"] << expanded_path
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def ___execute_initializer___?
|
43
|
+
# Only execute when not doing DB actions
|
44
|
+
boolean = defined?(ARGV) ? true : false # for when no ARGVs are provided, we know its a railsc or rails s explicit
|
45
|
+
boolean = false if boolean && ARGV[0]&.include?('db') # when its the DB rake tasks
|
46
|
+
boolean = false if boolean && ARGV[0]&.include?('asset') # when its an asset
|
47
|
+
boolean = false if boolean && ARGV[0]&.include?(':') # else this delim should never be included
|
48
|
+
boolean = false if ENV['SKIP_CUSTOM_INIT']=='true' # explicitly set the variable to skip shit
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'twilio-ruby'
|
2
|
+
|
3
|
+
class TwilioHelper
|
4
|
+
class << self
|
5
|
+
TWILIO_ACCOUNT_SID = RailsBase.config.mfa.twilio_sid
|
6
|
+
TWILIO_AUTH_TOKEN = RailsBase.config.mfa.twilio_auth_token
|
7
|
+
TWILIO_FROM_NUMBER = RailsBase.config.mfa.twilio_from_number
|
8
|
+
|
9
|
+
def send_sms(message:, to:)
|
10
|
+
Rails.logger.info "Sending Twilio message:[#{message}] to [#{to}]"
|
11
|
+
msg = client.messages.create(
|
12
|
+
from: TWILIO_FROM_NUMBER,
|
13
|
+
to: to,
|
14
|
+
body: message
|
15
|
+
)
|
16
|
+
|
17
|
+
Rails.logger.info("SID: #{msg.sid}")
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def client
|
23
|
+
@client ||= Twilio::REST::Client.new(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
module VelocityLimiter
|
2
|
+
def velocity_limit_reached?
|
3
|
+
_velocity_limiter_params_validator!
|
4
|
+
|
5
|
+
metadata = vl_metadata
|
6
|
+
|
7
|
+
log(level: :info, msg: "#{cache_key} has attempted #{self.class.name} #{metadata[:within_attempts_count]} times since #{metadata[:threshold]}")
|
8
|
+
|
9
|
+
if metadata[:velocity_reached]
|
10
|
+
log(level: :warn, msg: "#{cache_key} has been velocity limited. #{metadata[:within_attempts_count]} attempts since #{metadata[:threshold]}. MAX allowed is #{velocity_max}")
|
11
|
+
log(level: :warn, msg: "#{cache_key} may try again in #{metadata[:to_words]} :: #{metadata[:attempt_again_at]}. Will fully reset at #{metadata[:fully_reset_time]}")
|
12
|
+
msg = "Velocity limit reached for SMS verification. You may try again in #{metadata[:to_words]}"
|
13
|
+
return {reached: true, msg: msg}
|
14
|
+
end
|
15
|
+
|
16
|
+
vl_write!(metadata[:vl_write])
|
17
|
+
|
18
|
+
{ reached: false }
|
19
|
+
end
|
20
|
+
|
21
|
+
def _velocity_limiter_params_validator!
|
22
|
+
raise "Parent overloaded velocity_max_in_frame. Expected to be a ActiveSupport::Duration" unless velocity_max_in_frame.is_a? ActiveSupport::Duration
|
23
|
+
raise "Parent overloaded velocity_frame. Expected to be a ActiveSupport::Duration" unless velocity_frame.is_a? ActiveSupport::Duration
|
24
|
+
raise "Parent overloaded velocity_max. Expected to be a Integer" unless velocity_max.is_a? Integer
|
25
|
+
raise "Parent overloaded velocity_max. Expected to be a Integer greater than 1" if velocity_max < 1
|
26
|
+
raise "Parent overloaded cache_key. Expected to be a String" unless cache_key.is_a? String
|
27
|
+
end
|
28
|
+
|
29
|
+
def velocity_max_in_frame
|
30
|
+
end
|
31
|
+
|
32
|
+
def velocity_max
|
33
|
+
end
|
34
|
+
|
35
|
+
def velocity_frame
|
36
|
+
end
|
37
|
+
|
38
|
+
def cache_delineator
|
39
|
+
','
|
40
|
+
end
|
41
|
+
|
42
|
+
def vl_time
|
43
|
+
@vl_time ||= Time.zone.now
|
44
|
+
end
|
45
|
+
|
46
|
+
def vl_metadata(vl_arr: vl_read)
|
47
|
+
threshold = vl_time - velocity_max_in_frame
|
48
|
+
within_attempts = vl_arr.select do |time|
|
49
|
+
time >= threshold
|
50
|
+
end
|
51
|
+
attempt_again_at = within_attempts.first ? (within_attempts.first + velocity_max_in_frame) : Time.zone.now
|
52
|
+
|
53
|
+
obj = {}
|
54
|
+
obj[:vl_write] = [within_attempts, vl_time].flatten
|
55
|
+
obj[:fully_reset_time] = (within_attempts.last || Time.zone.now) + velocity_max_in_frame
|
56
|
+
obj[:attempt_again_at] = attempt_again_at
|
57
|
+
obj[:velocity_reached] = within_attempts.count >= velocity_max
|
58
|
+
obj[:within_attempts_arr] = within_attempts
|
59
|
+
obj[:within_attempts_count] = within_attempts.count
|
60
|
+
obj[:threshold] = threshold
|
61
|
+
obj[:velocity_max] = velocity_max
|
62
|
+
obj[:velocity_frame] = velocity_frame
|
63
|
+
obj[:velocity_max_in_frame] = velocity_max_in_frame
|
64
|
+
obj[:to_words] = distance_of_time_in_words(Time.zone.now, attempt_again_at, include_seconds: true)
|
65
|
+
|
66
|
+
obj
|
67
|
+
end
|
68
|
+
|
69
|
+
def vl_read
|
70
|
+
json = Rails.cache.fetch(cache_key) || ''
|
71
|
+
begin
|
72
|
+
array = json.split(cache_delineator).map { |time| Time.zone.parse time }
|
73
|
+
rescue StandardError => e
|
74
|
+
log(level: :error, msg: "Failed to parse json strings into time. #{json}")
|
75
|
+
array = []
|
76
|
+
end
|
77
|
+
log(level: :info, msg: "Read from #{cache_key} :: #{array}")
|
78
|
+
|
79
|
+
array
|
80
|
+
end
|
81
|
+
|
82
|
+
def vl_write!(write)
|
83
|
+
cache_write = write.map(&:to_s).join(cache_delineator)
|
84
|
+
log(level: :info, msg: "Writing [#{cache_write}] to #{cache_key}")
|
85
|
+
Rails.cache.write(cache_key, cache_write, expires_in: velocity_frame)
|
86
|
+
end
|
87
|
+
|
88
|
+
def cache_key
|
89
|
+
raise "cache_key must be defined in the parent class"
|
90
|
+
end
|
91
|
+
end
|
metadata
ADDED
@@ -0,0 +1,619 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_base
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.51.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Matt Taylor
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '5'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: mysql2
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: sass-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: uglifier
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: turbolinks
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: coffee-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: jquery-rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.3'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 4.3.3
|
107
|
+
type: :runtime
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '4.3'
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 4.3.3
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rails-ujs
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 0.1.0
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 0.1.0
|
131
|
+
- !ruby/object:Gem::Dependency
|
132
|
+
name: bootstrap
|
133
|
+
requirement: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - "~>"
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 4.6.0
|
138
|
+
type: :runtime
|
139
|
+
prerelease: false
|
140
|
+
version_requirements: !ruby/object:Gem::Requirement
|
141
|
+
requirements:
|
142
|
+
- - "~>"
|
143
|
+
- !ruby/object:Gem::Version
|
144
|
+
version: 4.6.0
|
145
|
+
- !ruby/object:Gem::Dependency
|
146
|
+
name: devise
|
147
|
+
requirement: !ruby/object:Gem::Requirement
|
148
|
+
requirements:
|
149
|
+
- - ">="
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
type: :runtime
|
153
|
+
prerelease: false
|
154
|
+
version_requirements: !ruby/object:Gem::Requirement
|
155
|
+
requirements:
|
156
|
+
- - ">="
|
157
|
+
- !ruby/object:Gem::Version
|
158
|
+
version: '0'
|
159
|
+
- !ruby/object:Gem::Dependency
|
160
|
+
name: twilio-ruby
|
161
|
+
requirement: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
type: :runtime
|
167
|
+
prerelease: false
|
168
|
+
version_requirements: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - ">="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
- !ruby/object:Gem::Dependency
|
174
|
+
name: interactor
|
175
|
+
requirement: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - ">="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
type: :runtime
|
181
|
+
prerelease: false
|
182
|
+
version_requirements: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: allow_numeric
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :runtime
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: jquery_mask_rails
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - ">="
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0'
|
208
|
+
type: :runtime
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - ">="
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: dalli
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
type: :runtime
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - ">="
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: browser
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - ">="
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0'
|
236
|
+
type: :runtime
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - ">="
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0'
|
243
|
+
- !ruby/object:Gem::Dependency
|
244
|
+
name: dotiw
|
245
|
+
requirement: !ruby/object:Gem::Requirement
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
version: '0'
|
250
|
+
type: :runtime
|
251
|
+
prerelease: false
|
252
|
+
version_requirements: !ruby/object:Gem::Requirement
|
253
|
+
requirements:
|
254
|
+
- - ">="
|
255
|
+
- !ruby/object:Gem::Version
|
256
|
+
version: '0'
|
257
|
+
- !ruby/object:Gem::Dependency
|
258
|
+
name: redis
|
259
|
+
requirement: !ruby/object:Gem::Requirement
|
260
|
+
requirements:
|
261
|
+
- - ">="
|
262
|
+
- !ruby/object:Gem::Version
|
263
|
+
version: 4.2.5
|
264
|
+
type: :runtime
|
265
|
+
prerelease: false
|
266
|
+
version_requirements: !ruby/object:Gem::Requirement
|
267
|
+
requirements:
|
268
|
+
- - ">="
|
269
|
+
- !ruby/object:Gem::Version
|
270
|
+
version: 4.2.5
|
271
|
+
- !ruby/object:Gem::Dependency
|
272
|
+
name: redis-namespace
|
273
|
+
requirement: !ruby/object:Gem::Requirement
|
274
|
+
requirements:
|
275
|
+
- - ">="
|
276
|
+
- !ruby/object:Gem::Version
|
277
|
+
version: 1.8.1
|
278
|
+
type: :runtime
|
279
|
+
prerelease: false
|
280
|
+
version_requirements: !ruby/object:Gem::Requirement
|
281
|
+
requirements:
|
282
|
+
- - ">="
|
283
|
+
- !ruby/object:Gem::Version
|
284
|
+
version: 1.8.1
|
285
|
+
- !ruby/object:Gem::Dependency
|
286
|
+
name: switch_user
|
287
|
+
requirement: !ruby/object:Gem::Requirement
|
288
|
+
requirements:
|
289
|
+
- - ">="
|
290
|
+
- !ruby/object:Gem::Version
|
291
|
+
version: '0'
|
292
|
+
type: :runtime
|
293
|
+
prerelease: false
|
294
|
+
version_requirements: !ruby/object:Gem::Requirement
|
295
|
+
requirements:
|
296
|
+
- - ">="
|
297
|
+
- !ruby/object:Gem::Version
|
298
|
+
version: '0'
|
299
|
+
- !ruby/object:Gem::Dependency
|
300
|
+
name: annotate
|
301
|
+
requirement: !ruby/object:Gem::Requirement
|
302
|
+
requirements:
|
303
|
+
- - ">="
|
304
|
+
- !ruby/object:Gem::Version
|
305
|
+
version: '0'
|
306
|
+
type: :development
|
307
|
+
prerelease: false
|
308
|
+
version_requirements: !ruby/object:Gem::Requirement
|
309
|
+
requirements:
|
310
|
+
- - ">="
|
311
|
+
- !ruby/object:Gem::Version
|
312
|
+
version: '0'
|
313
|
+
- !ruby/object:Gem::Dependency
|
314
|
+
name: spring-watcher-listen
|
315
|
+
requirement: !ruby/object:Gem::Requirement
|
316
|
+
requirements:
|
317
|
+
- - ">="
|
318
|
+
- !ruby/object:Gem::Version
|
319
|
+
version: '0'
|
320
|
+
type: :development
|
321
|
+
prerelease: false
|
322
|
+
version_requirements: !ruby/object:Gem::Requirement
|
323
|
+
requirements:
|
324
|
+
- - ">="
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '0'
|
327
|
+
- !ruby/object:Gem::Dependency
|
328
|
+
name: spring
|
329
|
+
requirement: !ruby/object:Gem::Requirement
|
330
|
+
requirements:
|
331
|
+
- - ">="
|
332
|
+
- !ruby/object:Gem::Version
|
333
|
+
version: '0'
|
334
|
+
type: :development
|
335
|
+
prerelease: false
|
336
|
+
version_requirements: !ruby/object:Gem::Requirement
|
337
|
+
requirements:
|
338
|
+
- - ">="
|
339
|
+
- !ruby/object:Gem::Version
|
340
|
+
version: '0'
|
341
|
+
- !ruby/object:Gem::Dependency
|
342
|
+
name: listen
|
343
|
+
requirement: !ruby/object:Gem::Requirement
|
344
|
+
requirements:
|
345
|
+
- - ">="
|
346
|
+
- !ruby/object:Gem::Version
|
347
|
+
version: '0'
|
348
|
+
type: :development
|
349
|
+
prerelease: false
|
350
|
+
version_requirements: !ruby/object:Gem::Requirement
|
351
|
+
requirements:
|
352
|
+
- - ">="
|
353
|
+
- !ruby/object:Gem::Version
|
354
|
+
version: '0'
|
355
|
+
- !ruby/object:Gem::Dependency
|
356
|
+
name: web-console
|
357
|
+
requirement: !ruby/object:Gem::Requirement
|
358
|
+
requirements:
|
359
|
+
- - ">="
|
360
|
+
- !ruby/object:Gem::Version
|
361
|
+
version: '0'
|
362
|
+
type: :development
|
363
|
+
prerelease: false
|
364
|
+
version_requirements: !ruby/object:Gem::Requirement
|
365
|
+
requirements:
|
366
|
+
- - ">="
|
367
|
+
- !ruby/object:Gem::Version
|
368
|
+
version: '0'
|
369
|
+
- !ruby/object:Gem::Dependency
|
370
|
+
name: byebug
|
371
|
+
requirement: !ruby/object:Gem::Requirement
|
372
|
+
requirements:
|
373
|
+
- - ">="
|
374
|
+
- !ruby/object:Gem::Version
|
375
|
+
version: '0'
|
376
|
+
type: :development
|
377
|
+
prerelease: false
|
378
|
+
version_requirements: !ruby/object:Gem::Requirement
|
379
|
+
requirements:
|
380
|
+
- - ">="
|
381
|
+
- !ruby/object:Gem::Version
|
382
|
+
version: '0'
|
383
|
+
- !ruby/object:Gem::Dependency
|
384
|
+
name: capybara
|
385
|
+
requirement: !ruby/object:Gem::Requirement
|
386
|
+
requirements:
|
387
|
+
- - ">="
|
388
|
+
- !ruby/object:Gem::Version
|
389
|
+
version: '2.15'
|
390
|
+
type: :development
|
391
|
+
prerelease: false
|
392
|
+
version_requirements: !ruby/object:Gem::Requirement
|
393
|
+
requirements:
|
394
|
+
- - ">="
|
395
|
+
- !ruby/object:Gem::Version
|
396
|
+
version: '2.15'
|
397
|
+
description: This is a description
|
398
|
+
email:
|
399
|
+
- mattius.taylor@gmail.com
|
400
|
+
executables: []
|
401
|
+
extensions: []
|
402
|
+
extra_rdoc_files: []
|
403
|
+
files:
|
404
|
+
- MIT-LICENSE
|
405
|
+
- README.md
|
406
|
+
- Rakefile
|
407
|
+
- app/assets/config/rails_base/manifest.js
|
408
|
+
- app/assets/images/rails_base/favicon.ico
|
409
|
+
- app/assets/javascripts/rails_base/admin.js
|
410
|
+
- app/assets/javascripts/rails_base/application.js
|
411
|
+
- app/assets/javascripts/rails_base/cable.js
|
412
|
+
- app/assets/javascripts/rails_base/mfa_auth.coffee
|
413
|
+
- app/assets/javascripts/rails_base/secondary_authentication.coffee
|
414
|
+
- app/assets/javascripts/rails_base/sessions.js
|
415
|
+
- app/assets/javascripts/rails_base/user_settings.coffee
|
416
|
+
- app/assets/stylesheets/rails_base/admin.css
|
417
|
+
- app/assets/stylesheets/rails_base/application.scss
|
418
|
+
- app/assets/stylesheets/rails_base/mfa_auth.scss
|
419
|
+
- app/assets/stylesheets/rails_base/scaffolds.scss
|
420
|
+
- app/assets/stylesheets/rails_base/secondary_authentication.scss
|
421
|
+
- app/assets/stylesheets/rails_base/user_settings.scss
|
422
|
+
- app/controllers/rails_base/admin_controller.rb
|
423
|
+
- app/controllers/rails_base/application_controller.rb
|
424
|
+
- app/controllers/rails_base/errors_controller.rb
|
425
|
+
- app/controllers/rails_base/mfa_auth_controller.rb
|
426
|
+
- app/controllers/rails_base/secondary_authentication_controller.rb
|
427
|
+
- app/controllers/rails_base/switch_user_controller.rb
|
428
|
+
- app/controllers/rails_base/user_settings_controller.rb
|
429
|
+
- app/controllers/rails_base/users/passwords_controller.rb
|
430
|
+
- app/controllers/rails_base/users/registrations_controller.rb
|
431
|
+
- app/controllers/rails_base/users/sessions_controller.rb
|
432
|
+
- app/helpers/rails_base/admin_helper.rb
|
433
|
+
- app/helpers/rails_base/appearance_helper.rb
|
434
|
+
- app/helpers/rails_base/application_helper.rb
|
435
|
+
- app/helpers/rails_base/capture_reference_helper.rb
|
436
|
+
- app/helpers/rails_base/mfa_auth_helper.rb
|
437
|
+
- app/helpers/rails_base/secondary_authentication_helper.rb
|
438
|
+
- app/helpers/rails_base/user_field_validators.rb
|
439
|
+
- app/helpers/rails_base/user_settings_helper.rb
|
440
|
+
- app/jobs/rails_base/application_job.rb
|
441
|
+
- app/jobs/twilio_job.rb
|
442
|
+
- app/mailers/rails_base/application_mailer.rb
|
443
|
+
- app/mailers/rails_base/email_verification_mailer.rb
|
444
|
+
- app/mailers/rails_base/event_mailer.rb
|
445
|
+
- app/models/admin_action.rb
|
446
|
+
- app/models/rails_base/application_record.rb
|
447
|
+
- app/models/rails_base/user_constants.rb
|
448
|
+
- app/models/secret.rb
|
449
|
+
- app/models/short_lived_data.rb
|
450
|
+
- app/models/user.rb
|
451
|
+
- app/services/rails_base/admin_risky_mfa_send.rb
|
452
|
+
- app/services/rails_base/admin_update_attribute.rb
|
453
|
+
- app/services/rails_base/authentication/authenticate_user.rb
|
454
|
+
- app/services/rails_base/authentication/constants.rb
|
455
|
+
- app/services/rails_base/authentication/decision_twofa_type.rb
|
456
|
+
- app/services/rails_base/authentication/destroy_user.rb
|
457
|
+
- app/services/rails_base/authentication/mfa_set_encrypt_token.rb
|
458
|
+
- app/services/rails_base/authentication/mfa_validator.rb
|
459
|
+
- app/services/rails_base/authentication/modify_password.rb
|
460
|
+
- app/services/rails_base/authentication/send_forgot_password.rb
|
461
|
+
- app/services/rails_base/authentication/send_login_mfa_to_user.rb
|
462
|
+
- app/services/rails_base/authentication/send_verification_email.rb
|
463
|
+
- app/services/rails_base/authentication/session_token_verifier.rb
|
464
|
+
- app/services/rails_base/authentication/single_sign_on_create.rb
|
465
|
+
- app/services/rails_base/authentication/single_sign_on_send.rb
|
466
|
+
- app/services/rails_base/authentication/single_sign_on_verify.rb
|
467
|
+
- app/services/rails_base/authentication/sso_verify_email.rb
|
468
|
+
- app/services/rails_base/authentication/update_phone_send_verification.rb
|
469
|
+
- app/services/rails_base/authentication/verify_forgot_password.rb
|
470
|
+
- app/services/rails_base/email_change.rb
|
471
|
+
- app/services/rails_base/encryption.rb
|
472
|
+
- app/services/rails_base/name_change.rb
|
473
|
+
- app/services/rails_base/service_base.rb
|
474
|
+
- app/services/rails_base/service_logging.rb
|
475
|
+
- app/views/layouts/rails_base/application.html.erb
|
476
|
+
- app/views/layouts/rails_base/mailer.html.erb
|
477
|
+
- app/views/layouts/rails_base/mailer.text.erb
|
478
|
+
- app/views/new.html.erb
|
479
|
+
- app/views/rails_base/admin/history.html.erb
|
480
|
+
- app/views/rails_base/admin/index.html.erb
|
481
|
+
- app/views/rails_base/admin/show_config.html.erb
|
482
|
+
- app/views/rails_base/devise/confirmations/new.html.erb
|
483
|
+
- app/views/rails_base/devise/mailer/confirmation_instructions.html.erb
|
484
|
+
- app/views/rails_base/devise/mailer/email_changed.html.erb
|
485
|
+
- app/views/rails_base/devise/mailer/password_change.html.erb
|
486
|
+
- app/views/rails_base/devise/mailer/reset_password_instructions.html.erb
|
487
|
+
- app/views/rails_base/devise/mailer/unlock_instructions.html.erb
|
488
|
+
- app/views/rails_base/devise/passwords/edit.html.erb
|
489
|
+
- app/views/rails_base/devise/passwords/new.html.erb
|
490
|
+
- app/views/rails_base/devise/registrations/edit.html.erb
|
491
|
+
- app/views/rails_base/devise/registrations/new.html.erb
|
492
|
+
- app/views/rails_base/devise/sessions/new.html.erb
|
493
|
+
- app/views/rails_base/devise/shared/_error_messages.html.erb
|
494
|
+
- app/views/rails_base/devise/shared/_links.html.erb
|
495
|
+
- app/views/rails_base/devise/unlocks/new.html.erb
|
496
|
+
- app/views/rails_base/email_verification_mailer/email_verification.html.erb
|
497
|
+
- app/views/rails_base/email_verification_mailer/event.html.erb
|
498
|
+
- app/views/rails_base/email_verification_mailer/forgot_password.html.erb
|
499
|
+
- app/views/rails_base/errors/internal_error.html.erb
|
500
|
+
- app/views/rails_base/errors/not_found.html.erb
|
501
|
+
- app/views/rails_base/errors/unacceptable.html.erb
|
502
|
+
- app/views/rails_base/event_mailer/event.html.erb
|
503
|
+
- app/views/rails_base/mfa_auth/mfa_code.html.erb
|
504
|
+
- app/views/rails_base/secondary_authentication/after_email_login_session_new.html.erb
|
505
|
+
- app/views/rails_base/secondary_authentication/forgot_password.html.erb
|
506
|
+
- app/views/rails_base/secondary_authentication/remove_me.html.erb
|
507
|
+
- app/views/rails_base/secondary_authentication/static.html.erb
|
508
|
+
- app/views/rails_base/shared/_admin_actions_modal.html.erb
|
509
|
+
- app/views/rails_base/shared/_admin_config_class.html.erb
|
510
|
+
- app/views/rails_base/shared/_admin_history.html.erb
|
511
|
+
- app/views/rails_base/shared/_admin_modify_email.html.erb
|
512
|
+
- app/views/rails_base/shared/_admin_modify_name.html.erb
|
513
|
+
- app/views/rails_base/shared/_admin_modify_phone.html.erb
|
514
|
+
- app/views/rails_base/shared/_admin_modify_text.html.erb
|
515
|
+
- app/views/rails_base/shared/_admin_risky_change.html.erb
|
516
|
+
- app/views/rails_base/shared/_admin_risky_mfa.html.erb
|
517
|
+
- app/views/rails_base/shared/_admin_selector_dropdown.html.erb
|
518
|
+
- app/views/rails_base/shared/_admin_toggle_button.html.erb
|
519
|
+
- app/views/rails_base/shared/_admin_warning_alert.html.erb
|
520
|
+
- app/views/rails_base/shared/_appearance_mode_selector.html.erb
|
521
|
+
- app/views/rails_base/shared/_custom_form_validation_javascript.html.erb
|
522
|
+
- app/views/rails_base/shared/_enable_mfa_auth_modal.html.erb
|
523
|
+
- app/views/rails_base/shared/_error_pages.html.erb
|
524
|
+
- app/views/rails_base/shared/_logged_in_header.html.erb
|
525
|
+
- app/views/rails_base/shared/_logged_out_header.html.erb
|
526
|
+
- app/views/rails_base/shared/_mfa_input_layout.html.erb
|
527
|
+
- app/views/rails_base/shared/_mfa_input_layout_default.html.erb
|
528
|
+
- app/views/rails_base/shared/_mfa_input_layout_fallback.html.erb
|
529
|
+
- app/views/rails_base/shared/_modify_mfa_auth_modal.html.erb
|
530
|
+
- app/views/rails_base/shared/_password_confirm_javascript.html.erb
|
531
|
+
- app/views/rails_base/shared/_reset_password_form.html.erb
|
532
|
+
- app/views/rails_base/shared/_session_create_form.html.erb
|
533
|
+
- app/views/rails_base/shared/_session_timeout_modal.html.erb
|
534
|
+
- app/views/rails_base/switch_user/_widget.html.erb
|
535
|
+
- app/views/rails_base/user_settings/_confirm_destroy_user.html.erb
|
536
|
+
- app/views/rails_base/user_settings/_destroy_user.html.erb
|
537
|
+
- app/views/rails_base/user_settings/_modify_name.html.erb
|
538
|
+
- app/views/rails_base/user_settings/_modify_password.html.erb
|
539
|
+
- app/views/rails_base/user_settings/_modify_password_update_password.html.erb
|
540
|
+
- app/views/rails_base/user_settings/index.html.erb
|
541
|
+
- config/initializers/01_rails_config.rb
|
542
|
+
- config/initializers/admin_action_helper.rb
|
543
|
+
- config/initializers/browser.rb
|
544
|
+
- config/initializers/default_logged_in_headers.rb
|
545
|
+
- config/initializers/devise.rb
|
546
|
+
- config/initializers/encryption.rb
|
547
|
+
- config/initializers/switch_user.rb
|
548
|
+
- config/initializers/switch_user_helper.rb
|
549
|
+
- config/locales/devise.en.yml
|
550
|
+
- config/locales/en.yml
|
551
|
+
- config/routes.rb
|
552
|
+
- db/migrate/20210212175453_devise_create_rails_base_users.rb
|
553
|
+
- db/migrate/20210212190537_create_rails_base_short_lived_data.rb
|
554
|
+
- db/migrate/20210212192645_create_rails_base_secrets.rb
|
555
|
+
- db/migrate/20210406015744_create_rails_base_admin_actions.rb
|
556
|
+
- db/seeds.rb
|
557
|
+
- lib/link_decision_helper.rb
|
558
|
+
- lib/rails_base.rb
|
559
|
+
- lib/rails_base/admin/action_cache.rb
|
560
|
+
- lib/rails_base/admin/action_helper.rb
|
561
|
+
- lib/rails_base/admin/default_index_tile.rb
|
562
|
+
- lib/rails_base/admin/index_tile.rb
|
563
|
+
- lib/rails_base/config.rb
|
564
|
+
- lib/rails_base/configuration/active_job.rb
|
565
|
+
- lib/rails_base/configuration/admin.rb
|
566
|
+
- lib/rails_base/configuration/app.rb
|
567
|
+
- lib/rails_base/configuration/appearance.rb
|
568
|
+
- lib/rails_base/configuration/authentication.rb
|
569
|
+
- lib/rails_base/configuration/base.rb
|
570
|
+
- lib/rails_base/configuration/display/background_color.rb
|
571
|
+
- lib/rails_base/configuration/display/btn_danger.rb
|
572
|
+
- lib/rails_base/configuration/display/btn_dark.rb
|
573
|
+
- lib/rails_base/configuration/display/btn_info.rb
|
574
|
+
- lib/rails_base/configuration/display/btn_light.rb
|
575
|
+
- lib/rails_base/configuration/display/btn_primary.rb
|
576
|
+
- lib/rails_base/configuration/display/btn_secondary.rb
|
577
|
+
- lib/rails_base/configuration/display/btn_success.rb
|
578
|
+
- lib/rails_base/configuration/display/btn_warning.rb
|
579
|
+
- lib/rails_base/configuration/display/footer.rb
|
580
|
+
- lib/rails_base/configuration/display/navbar.rb
|
581
|
+
- lib/rails_base/configuration/display/table_body.rb
|
582
|
+
- lib/rails_base/configuration/display/table_header.rb
|
583
|
+
- lib/rails_base/configuration/display/text.rb
|
584
|
+
- lib/rails_base/configuration/exceptions_app.rb
|
585
|
+
- lib/rails_base/configuration/login_behavior.rb
|
586
|
+
- lib/rails_base/configuration/mailer.rb
|
587
|
+
- lib/rails_base/configuration/mfa.rb
|
588
|
+
- lib/rails_base/configuration/owner.rb
|
589
|
+
- lib/rails_base/configuration/redis.rb
|
590
|
+
- lib/rails_base/configuration/user.rb
|
591
|
+
- lib/rails_base/engine.rb
|
592
|
+
- lib/rails_base/version.rb
|
593
|
+
- lib/tasks/rails_base_tasks.rake
|
594
|
+
- lib/twilio_helper.rb
|
595
|
+
- lib/velocity_limiter.rb
|
596
|
+
homepage:
|
597
|
+
licenses:
|
598
|
+
- MIT
|
599
|
+
metadata: {}
|
600
|
+
post_install_message:
|
601
|
+
rdoc_options: []
|
602
|
+
require_paths:
|
603
|
+
- lib
|
604
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
605
|
+
requirements:
|
606
|
+
- - ">="
|
607
|
+
- !ruby/object:Gem::Version
|
608
|
+
version: '0'
|
609
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
610
|
+
requirements:
|
611
|
+
- - ">="
|
612
|
+
- !ruby/object:Gem::Version
|
613
|
+
version: '0'
|
614
|
+
requirements: []
|
615
|
+
rubygems_version: 3.1.2
|
616
|
+
signing_key:
|
617
|
+
specification_version: 4
|
618
|
+
summary: This is a summary
|
619
|
+
test_files: []
|