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 @@
|
|
1
|
+
<%= yield %>
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<div id='admin-history-content'>
|
2
|
+
<%= render partial: 'rails_base/shared/admin_history' %>
|
3
|
+
<div>
|
4
|
+
|
5
|
+
<script type="text/javascript">
|
6
|
+
function submit_paginate(page, prev_page, prev_count){
|
7
|
+
var input_page_count = $('#pagination_count').val()
|
8
|
+
var admin = $('#rb_admin_user_select').val()
|
9
|
+
var user = $('#rb_user_select').val()
|
10
|
+
$.ajax({
|
11
|
+
type: "POST",
|
12
|
+
url: "<%= RailsBase.url_routes.admin_history_page_path %>",
|
13
|
+
headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') },
|
14
|
+
dataType: 'json',
|
15
|
+
data: { 'page': page , 'pagination_count': input_page_count, 'prev_page': prev_page, 'prev_count': prev_count, 'user': user, 'admin': admin },
|
16
|
+
success: function(data) {
|
17
|
+
$('#admin-history-content').html(data.html)
|
18
|
+
_rails_base_display_success(`Succesfully updated Rows for page ${data.page}. Showing ${data.per_page} rows per page.`);
|
19
|
+
},
|
20
|
+
error: function(xhr, status, error) {
|
21
|
+
_rails_base_display_alert('Failed to reload history. Try again');
|
22
|
+
}
|
23
|
+
})
|
24
|
+
};
|
25
|
+
|
26
|
+
</script>
|
@@ -0,0 +1,149 @@
|
|
1
|
+
|
2
|
+
<% filters = RailsBase.config.admin.admin_page_filter.map { |f| [f[:filter], f[:id]] } %>
|
3
|
+
<div class='row text-center justify-content-center'>
|
4
|
+
<div class='col-md-4 col-md-offset-4'>
|
5
|
+
<%= select_tag 'admin_filter_user_by', options_for_select(filters), include_blank: 'Filter Users', class: 'form-control', onchange: 'filter_admins()' %>
|
6
|
+
</div>
|
7
|
+
</div>
|
8
|
+
<div class='table-responsive' style="overflow-x:auto; width: inherit !important;">
|
9
|
+
<table class="tableFixHead table table-striped table-bordered">
|
10
|
+
<thead class="thead-dark text-center">
|
11
|
+
<% RailsBase.config.admin.admin_page_tiles.each do |tile| %>
|
12
|
+
<th <%= "style='min-width:300px'" if tile.min_width %>> <%= tile.col_name %> </th>
|
13
|
+
<% end %>
|
14
|
+
</thead>
|
15
|
+
<tbody class='text-center'>
|
16
|
+
<% admin_user = current_user %>
|
17
|
+
<% User.all.each do |user| %>
|
18
|
+
<% id_base = "#{user.id}_#{(100*rand).to_i}" %>
|
19
|
+
<tr class='admin_filter_tr <%= filtered_classes(user, admin_user) %>'>
|
20
|
+
<% RailsBase.config.admin.admin_page_tiles.each do |tile| %>
|
21
|
+
<td id='<%= id_base %>_<%= tile.name %>' >
|
22
|
+
<% case tile.type %>
|
23
|
+
<% when :risky %>
|
24
|
+
<%= render partial: 'rails_base/shared/admin_risky_change', locals: { type: tile.name, current_value: tile.value.call(user), user: user, parent: id_base , modal_mapping: tile.name, disable_action: tile.disabled&.call(user, admin_user), disable_msg: tile.disabled_msg&.call(user, admin_user) } %>
|
25
|
+
<% when :toggle %>
|
26
|
+
<%= render partial: 'rails_base/shared/admin_toggle_button', locals: { type: tile.name, checked: tile.value.call(user), user: user, data_on: tile.on, data_off: tile.off, parent: id_base, disable_action: tile.disabled&.call(user, admin_user), disable_msg: tile.disabled_msg&.call(user, admin_user) } %>
|
27
|
+
<% when :selector %>
|
28
|
+
<%= render partial: 'rails_base/shared/admin_selector_dropdown', locals: { type: tile.name, options: tile.selector.call(user), selector: tile.value.call(user), user: user, parent: id_base, disable_action: tile.disabled&.call(user, admin_user), disable_msg: tile.disabled_msg&.call(user, admin_user) } %>
|
29
|
+
<% when :text %>
|
30
|
+
<%= render partial: 'rails_base/shared/admin_modify_text', locals: { type: tile.name , current_value: tile.value.call(user), user: user, parent: id_base, modal_partial: tile.partial, disable_action: tile.disabled&.call(user, admin_user), disable_msg: tile.disabled_msg&.call(user, admin_user) } %>
|
31
|
+
<% when :button %>
|
32
|
+
<% if tile.disabled&.call(user, admin_user) %>
|
33
|
+
<div>
|
34
|
+
<span style="width: 88%; float: left;">
|
35
|
+
<%= button_to tile.col_name, tile.url.call(user), method: tile.method, class: "btn btn-block btn-#{tile.color} stay-disabled", disabled: true %>
|
36
|
+
</span>
|
37
|
+
<span style="width: 8%; float: right;">
|
38
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-question-circle" viewBox="0 0 16 16" data-toggle='tooltip' title='<%= tile.disabled_msg&.call(user, admin_user) %> '>
|
39
|
+
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
|
40
|
+
<path d="M5.255 5.786a.237.237 0 0 0 .241.247h.825c.138 0 .248-.113.266-.25.09-.656.54-1.134 1.342-1.134.686 0 1.314.343 1.314 1.168 0 .635-.374.927-.965 1.371-.673.489-1.206 1.06-1.168 1.987l.003.217a.25.25 0 0 0 .25.246h.811a.25.25 0 0 0 .25-.25v-.105c0-.718.273-.927 1.01-1.486.609-.463 1.244-.977 1.244-2.056 0-1.511-1.276-2.241-2.673-2.241-1.267 0-2.655.59-2.75 2.286zm1.557 5.763c0 .533.425.927 1.01.927.609 0 1.028-.394 1.028-.927 0-.552-.42-.94-1.029-.94-.584 0-1.009.388-1.009.94z"/>
|
41
|
+
</svg>
|
42
|
+
</span>
|
43
|
+
</div>
|
44
|
+
<% else %>
|
45
|
+
<%= button_to tile.col_name, tile.url.call(user), method: tile.method, class: "btn btn-block btn-#{tile.color}"%>
|
46
|
+
<% end %>
|
47
|
+
<% when :plain %>
|
48
|
+
<%= tile.value.call(user) %>
|
49
|
+
<% end %>
|
50
|
+
</td>
|
51
|
+
<% end %>
|
52
|
+
</tr>
|
53
|
+
<% end %>
|
54
|
+
</tbody>
|
55
|
+
</table>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
<div class='modal fade' id='sharedAdminModal' tabindex='-1' role='dialog' aria-labelledby='sharedAdminModalLabel' aria-hidden='true'></div>
|
59
|
+
|
60
|
+
<script type="text/javascript">
|
61
|
+
var shared_admin_modal = 'sharedAdminModal'
|
62
|
+
|
63
|
+
function filter_admins(){
|
64
|
+
var class_id = $('#admin_filter_user_by').val()
|
65
|
+
if(class_id == ''){
|
66
|
+
$('.admin_filter_tr').show()
|
67
|
+
} else {
|
68
|
+
$('.admin_filter_tr').hide()
|
69
|
+
$(`.${class_id}`).show()
|
70
|
+
}
|
71
|
+
console.log(`id: ${class_id}`)
|
72
|
+
}
|
73
|
+
|
74
|
+
function show_shared_admin_modal(){
|
75
|
+
$(`#${shared_admin_modal}`).appendTo('body').modal('show');
|
76
|
+
}
|
77
|
+
|
78
|
+
function hide_shared_admin_modal(){
|
79
|
+
$(`#${shared_admin_modal}`).modal('hide');
|
80
|
+
clear_shared_admin_modal();
|
81
|
+
}
|
82
|
+
|
83
|
+
function set_shared_admin_modal_content(html){
|
84
|
+
$(`#${shared_admin_modal}`).html(html)
|
85
|
+
show_shared_admin_modal();
|
86
|
+
}
|
87
|
+
|
88
|
+
function clear_shared_admin_modal(){
|
89
|
+
set_shared_admin_modal_content('');
|
90
|
+
}
|
91
|
+
|
92
|
+
function admin_risky_mfa_send(modal_id){
|
93
|
+
_rails_base_hide_displays()
|
94
|
+
$.ajax({
|
95
|
+
type: "POST",
|
96
|
+
url: "<%= RailsBase.url_routes.admin_validate_intent_path%>",
|
97
|
+
headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') },
|
98
|
+
success: function(data) {
|
99
|
+
$(`#${modal_id}`).modal('show');
|
100
|
+
admin_risky_icon_proceed()
|
101
|
+
},
|
102
|
+
error: function(xhr, status, error) {
|
103
|
+
_rails_base_display_alert(xhr.responseJSON.message)
|
104
|
+
admin_risky_icon_proceed()
|
105
|
+
}
|
106
|
+
})
|
107
|
+
}
|
108
|
+
|
109
|
+
function admin_risky_mfa_confirm(mfa_string, curr_modal, modal_mapping, id, toggle_method, modify_id){
|
110
|
+
toggle_method('hide');
|
111
|
+
$.ajax({
|
112
|
+
type: "POST",
|
113
|
+
url: "<%= RailsBase.url_routes.admin_verify_intent_path%>",
|
114
|
+
headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') },
|
115
|
+
dataType: 'json',
|
116
|
+
data: { 'mfa_input': mfa_string , 'modal_mapping': modal_mapping, 'id': id, 'modify_id': modify_id },
|
117
|
+
success: function(data) {
|
118
|
+
$(`#${curr_modal}`).modal('hide');
|
119
|
+
set_shared_admin_modal_content(data.html);
|
120
|
+
toggle_method('show');
|
121
|
+
},
|
122
|
+
error: function(xhr, status, error) {
|
123
|
+
$(`#${curr_modal}`).modal('hide');
|
124
|
+
toggle_method('show');
|
125
|
+
_rails_base_display_alert(xhr.responseJSON.message)
|
126
|
+
}
|
127
|
+
})
|
128
|
+
}
|
129
|
+
|
130
|
+
function admin_risky_icon_wait(){
|
131
|
+
$('.risky-icon-og').hide()
|
132
|
+
$('.risky-icon-mask').show()
|
133
|
+
}
|
134
|
+
function admin_risky_icon_proceed(){
|
135
|
+
$('.risky-icon-og').show()
|
136
|
+
$('.risky-icon-mask').hide()
|
137
|
+
}
|
138
|
+
|
139
|
+
function admin_ensure_disabled(){
|
140
|
+
$('.stay-disabled').bootstrapToggle('disable')
|
141
|
+
}
|
142
|
+
|
143
|
+
function admin_pause_concurrency(){
|
144
|
+
$('.admin-concurrent-block').bootstrapToggle('disable');
|
145
|
+
}
|
146
|
+
function admin_resume_concurrency(){
|
147
|
+
$('.admin-concurrent-block').bootstrapToggle('enable');
|
148
|
+
}
|
149
|
+
</script>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<% RailsBase.config.instance_variables.each do |var| %>
|
2
|
+
<% instance = RailsBase.config.instance_variable_get(var) %>
|
3
|
+
<% klass = instance.class %>
|
4
|
+
<%= render partial: 'rails_base/shared/admin_config_class', locals: { instance: instance, klass: klass, var: var, prepend_shit: nil, rename: nil } %>
|
5
|
+
<% end %>
|
6
|
+
|
7
|
+
<% RailsBase.appearance.class::DOWNSTREAM_CLASSES.each do |var| %>
|
8
|
+
<% var = "@#{var}" %>
|
9
|
+
<% instance = RailsBase.appearance.instance_variable_get(var) %>
|
10
|
+
<% klass = instance.class %>
|
11
|
+
<%= render partial: 'rails_base/shared/admin_config_class', locals: { instance: instance, klass: klass, var: var, prepend_shit: 'appearance', rename: klass } %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<script type="text/javascript">
|
15
|
+
$(function () {
|
16
|
+
$('[data-toggle="popover"]').popover()
|
17
|
+
})
|
18
|
+
</script>
|
@@ -0,0 +1,16 @@
|
|
1
|
+
<h2>Resend confirmation instructions</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post }) do |f| %>
|
4
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", value: (resource.pending_reconfirmation? ? resource.unconfirmed_email : resource.email) %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<div class="actions">
|
12
|
+
<%= f.submit "Resend confirmation instructions" %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @email %>!</p>
|
2
|
+
|
3
|
+
<% if @resource.try(:unconfirmed_email?) %>
|
4
|
+
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
5
|
+
<% else %>
|
6
|
+
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
|
7
|
+
<% end %>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
|
+
|
5
|
+
<p><%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></p>
|
6
|
+
|
7
|
+
<p>If you didn't request this, please ignore this email.</p>
|
8
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Your account has been locked due to an excessive number of unsuccessful sign in attempts.</p>
|
4
|
+
|
5
|
+
<p>Click the link below to unlock your account:</p>
|
6
|
+
|
7
|
+
<p><%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %></p>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<h2>Change your password</h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
5
|
+
<%= f.hidden_field :reset_password_token %>
|
6
|
+
|
7
|
+
<div class="field">
|
8
|
+
<%= f.label :password, "New password" %><br />
|
9
|
+
<% if @minimum_password_length %>
|
10
|
+
<em>(<%= @minimum_password_length %> characters minimum)</em><br />
|
11
|
+
<% end %>
|
12
|
+
<%= f.password_field :password, autofocus: true, autocomplete: "new-password" %>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :password_confirmation, "Confirm new password" %><br />
|
17
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
<div class="actions">
|
21
|
+
<%= f.submit "Change my password" %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
|
25
|
+
<%= render "devise/shared/links" %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<h2 class='text-center'>Forgot your password?</h2>
|
2
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
3
|
+
|
4
|
+
|
5
|
+
<%= form_for(:user, as: :user, url: RailsBase.url_routes.user_password_path, html: { method: :post }) do |f| %>
|
6
|
+
|
7
|
+
<div class="field form-group row">
|
8
|
+
<div class="col-md-10 offset-md-1">
|
9
|
+
<%= f.label :email, class: 'text-center' %><br />
|
10
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email", placeholder: :email, class: 'form-control'%>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="actions row">
|
16
|
+
<div class="col-md-10 offset-md-1 text-center">
|
17
|
+
<div class="row">
|
18
|
+
<div class="col-md-9">
|
19
|
+
<%= f.submit "Send me reset password instructions", class: "btn btn_success btn-block" %>
|
20
|
+
</div>
|
21
|
+
<div class="col-md-3">
|
22
|
+
<a class="btn btn_primary btn-block" href="<%= RailsBase.url_routes.new_user_session_path %>" role="button">Sign in</a>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<h2>Edit <%= resource_name.to_s.humanize %></h2>
|
2
|
+
|
3
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %>
|
4
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
5
|
+
|
6
|
+
<div class="field">
|
7
|
+
<%= f.label :email %><br />
|
8
|
+
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
12
|
+
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<div class="field">
|
16
|
+
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
|
17
|
+
<%= f.password_field :password, autocomplete: "new-password" %>
|
18
|
+
<% if @minimum_password_length %>
|
19
|
+
<br />
|
20
|
+
<em><%= @minimum_password_length %> characters minimum</em>
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<div class="field">
|
25
|
+
<%= f.label :password_confirmation %><br />
|
26
|
+
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<div class="field">
|
30
|
+
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
|
31
|
+
<%= f.password_field :current_password, autocomplete: "current-password" %>
|
32
|
+
</div>
|
33
|
+
|
34
|
+
<div class="actions">
|
35
|
+
<%= f.submit "Update" %>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<h3>Cancel my account</h3>
|
40
|
+
|
41
|
+
<p>Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %></p>
|
42
|
+
|
43
|
+
<%= link_to "Back", :back %>
|
@@ -0,0 +1,123 @@
|
|
1
|
+
<h2 class="text-center <%= appearance_text_class %>">Sign up</h2>
|
2
|
+
|
3
|
+
<% resource ||= @resource %>
|
4
|
+
<% resource_name ||= @resource_name %>
|
5
|
+
|
6
|
+
<% validation_klass = 'form-validation' %>
|
7
|
+
<% submit_klass = 'registration-submit' %>
|
8
|
+
|
9
|
+
<%= form_for(resource, as: resource_name, url: RailsBase.url_routes.user_registration_path, html: { class: validation_klass, novalidate: true}) do |f| %>
|
10
|
+
<%= render "devise/shared/error_messages", resource: resource %>
|
11
|
+
|
12
|
+
<div class="field form-group row">
|
13
|
+
<div class="col-md-10 offset-md-1">
|
14
|
+
<%= f.label :first_name, class: appearance_text_class %>
|
15
|
+
<% klasses = ["form-control"] %>
|
16
|
+
<% klasses << "is-invalid" if @alert_errors&.keys&.include?(:first_name) %>
|
17
|
+
<%= f.text_field :first_name, class: klasses.join(' '), autofocus: true, autocomplete: "email", placeholder: "First Name", required: true %>
|
18
|
+
<div class="invalid-feedback">
|
19
|
+
First Name: <%= RailsBase::Authentication::Constants::NAME_VALIDATION%>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<div class="field form-group row">
|
24
|
+
<div class="col-md-10 offset-md-1">
|
25
|
+
<%= f.label :last_name, class: appearance_text_class %>
|
26
|
+
<% klasses = ["form-control"] %>
|
27
|
+
<% klasses << "is-invalid" if @alert_errors&.keys&.include?(:last_name) %>
|
28
|
+
<%= f.text_field :last_name, class: klasses.join(' '), autofocus: true, autocomplete: "email", placeholder: "Last Name", required: true %>
|
29
|
+
<div class="invalid-feedback">
|
30
|
+
Last Name: <%= RailsBase::Authentication::Constants::NAME_VALIDATION%>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
<div class="field form-group row">
|
35
|
+
<div class="col-md-10 offset-md-1">
|
36
|
+
<%= f.label :email, class: appearance_text_class %>
|
37
|
+
<%= f.email_field :email, class: 'form-control', autocomplete: "email", placeholder: "Email to verify: example@gmail.com", required: true %>
|
38
|
+
<div class="invalid-feedback">
|
39
|
+
Valid email is required
|
40
|
+
</div>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
|
44
|
+
<div class="field form-group row">
|
45
|
+
<div class="col-md-10 offset-md-1">
|
46
|
+
<%= f.label :password, class: appearance_text_class %>
|
47
|
+
<% klasses = ["form-control"] %>
|
48
|
+
<% klasses << "is-invalid" if @alert_errors&.keys&.include?(:password) %>
|
49
|
+
<%= f.password_field :password, class: klasses.join(' '), minlength: RailsBase::Authentication::Constants::MP_MIN_LENGTH, autocomplete: 'new-password', placeholder: "password", required: true %>
|
50
|
+
<div class="invalid-feedback">
|
51
|
+
<%= RailsBase::Authentication::Constants::MP_REQ_MESSAGE %>
|
52
|
+
</div>
|
53
|
+
</div>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
<div class="field form-group row">
|
57
|
+
<div class="col-md-10 offset-md-1">
|
58
|
+
<%= f.label :password_confirmation, class: appearance_text_class %>
|
59
|
+
<%= f.password_field :password_confirmation, class: 'form-control', autocomplete: "new-password", placeholder: "password confirmation", required: true %>
|
60
|
+
<div class="invalid-feedback">
|
61
|
+
Password Confirmation does not match Password
|
62
|
+
</div>
|
63
|
+
</div>
|
64
|
+
</div>
|
65
|
+
|
66
|
+
<div class="actions row">
|
67
|
+
<div class="col-md-10 offset-md-1 text-center">
|
68
|
+
</div>
|
69
|
+
<div class="col-md-10 offset-md-1 text-center">
|
70
|
+
<div class="row">
|
71
|
+
<div class="col-md-9">
|
72
|
+
<%= f.submit "Sign Up for #{Rails.application.class.parent_name}", class: "btn btn_success btn-block #{submit_klass}" %>
|
73
|
+
</div>
|
74
|
+
<div class="col-md-3">
|
75
|
+
<a class="btn btn_primary btn-block" href="<%=RailsBase.url_routes.new_user_session_path%>" role="button">Have an Account? Sign In</a>
|
76
|
+
</div>
|
77
|
+
</div>
|
78
|
+
</div>
|
79
|
+
</div>
|
80
|
+
<% end %>
|
81
|
+
|
82
|
+
<script type="text/javascript">
|
83
|
+
(function () {
|
84
|
+
'use strict'
|
85
|
+
|
86
|
+
// Fetch all the forms we want to apply custom Bootstrap validation styles to
|
87
|
+
var forms = document.querySelectorAll('.<%= validation_klass %>')
|
88
|
+
|
89
|
+
// Loop over them and prevent submission
|
90
|
+
Array.prototype.slice.call(forms)
|
91
|
+
.forEach(function (form) {
|
92
|
+
form.addEventListener('submit', function (event) {
|
93
|
+
console.log("im here")
|
94
|
+
if (!form.checkValidity()) {
|
95
|
+
event.preventDefault()
|
96
|
+
event.stopPropagation()
|
97
|
+
}
|
98
|
+
|
99
|
+
form.classList.add('was-validated')
|
100
|
+
}, false)
|
101
|
+
})
|
102
|
+
})()
|
103
|
+
</script>
|
104
|
+
|
105
|
+
<%
|
106
|
+
common_criteria = {
|
107
|
+
# required: true,
|
108
|
+
min_length: RailsBase::Authentication::Constants::MIN_NAME,
|
109
|
+
max_length: RailsBase::Authentication::Constants::MAX_NAME,
|
110
|
+
pattern: :name
|
111
|
+
}
|
112
|
+
values = [
|
113
|
+
{ name: '#user_first_name', criteria: common_criteria },
|
114
|
+
{ name: '#user_last_name', criteria: common_criteria },
|
115
|
+
{ name: '#user_email', criteria: { required: true, pattern: :email }}
|
116
|
+
]
|
117
|
+
function_name = 'new_registration'
|
118
|
+
%>
|
119
|
+
|
120
|
+
<%= render partial: 'rails_base/shared/custom_form_validation_javascript', locals: { function_name: function_name, values: values } %>
|
121
|
+
|
122
|
+
<%= render partial: 'rails_base/shared/password_confirm_javascript', locals: { id_password_conf: "#{resource_name}_password_confirmation", id_password: "#{resource_name}_password", form_klass: validation_klass, enable_submit: false, submit_klass: submit_klass, validation_events: [function_name] } %>
|
123
|
+
|