lesli_shield 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +7 -0
  2. data/Rakefile +5 -0
  3. data/app/assets/config/lesli_shield_manifest.js +47 -0
  4. data/app/assets/images/lesli_shield/shield-logo.svg +1 -0
  5. data/app/assets/javascripts/lesli_shield/application.js +4428 -0
  6. data/app/assets/javascripts/lesli_shield/confirmations.js +60 -0
  7. data/app/assets/javascripts/lesli_shield/passwords.js +712 -0
  8. data/app/assets/javascripts/lesli_shield/registrations.js +712 -0
  9. data/app/assets/javascripts/lesli_shield/sessions.js +712 -0
  10. data/app/assets/stylesheets/lesli_shield/application.css +4 -0
  11. data/app/assets/stylesheets/lesli_shield/confirmations.css +19219 -0
  12. data/app/assets/stylesheets/lesli_shield/passwords.css +19202 -0
  13. data/app/assets/stylesheets/lesli_shield/registrations.css +19588 -0
  14. data/app/assets/stylesheets/lesli_shield/sessions.css +19588 -0
  15. data/app/controllers/lesli_shield/application_controller.rb +4 -0
  16. data/app/controllers/lesli_shield/dashboard/components_controller.rb +60 -0
  17. data/app/controllers/lesli_shield/dashboards_controller.rb +4 -0
  18. data/app/controllers/users/confirmations_controller.rb +66 -0
  19. data/app/controllers/users/omniauth_callbacks_controller.rb +30 -0
  20. data/app/controllers/users/passwords_controller.rb +71 -0
  21. data/app/controllers/users/registrations_controller.rb +141 -0
  22. data/app/controllers/users/sessions_controller.rb +141 -0
  23. data/app/controllers/users/unlocks_controller.rb +30 -0
  24. data/app/helpers/lesli_shield/application_helper.rb +4 -0
  25. data/app/helpers/lesli_shield/dashboards_helper.rb +4 -0
  26. data/app/jobs/lesli_shield/application_job.rb +4 -0
  27. data/app/mailers/lesli_shield/application_mailer.rb +6 -0
  28. data/app/models/lesli_shield/application_record.rb +5 -0
  29. data/app/models/lesli_shield/dashboard/component.rb +18 -0
  30. data/app/models/lesli_shield/dashboard.rb +31 -0
  31. data/app/views/devise/confirmations/new.html.erb +2 -0
  32. data/app/views/devise/confirmations/show.html.erb +63 -0
  33. data/app/views/devise/mailer/confirmation_instructions.html.erb +5 -0
  34. data/app/views/devise/mailer/email_changed.html.erb +7 -0
  35. data/app/views/devise/mailer/password_change.html.erb +3 -0
  36. data/app/views/devise/mailer/reset_password_instructions.html.erb +8 -0
  37. data/app/views/devise/mailer/unlock_instructions.html.erb +7 -0
  38. data/app/views/devise/passwords/edit.html.erb +79 -0
  39. data/app/views/devise/passwords/new.html.erb +75 -0
  40. data/app/views/devise/registrations/edit.html.erb +43 -0
  41. data/app/views/devise/registrations/new.html.erb +151 -0
  42. data/app/views/devise/sessions/new.html.erb +114 -0
  43. data/app/views/devise/shared/_demo.html.erb +7 -0
  44. data/app/views/devise/shared/_error_messages.html.erb +15 -0
  45. data/app/views/devise/shared/_links.html.erb +96 -0
  46. data/app/views/devise/unlocks/new.html.erb +16 -0
  47. data/app/views/layouts/lesli_shield/application.html.erb +15 -0
  48. data/app/views/lesli_shield/dashboards/edit.html.erb +1 -0
  49. data/app/views/lesli_shield/dashboards/index.html.erb +1 -0
  50. data/app/views/lesli_shield/dashboards/new.html.erb +1 -0
  51. data/app/views/lesli_shield/dashboards/show.html.erb +1 -0
  52. data/config/initializers/devise.rb +336 -0
  53. data/config/locales/translations.en.yml +21 -0
  54. data/config/locales/translations.es.yml +21 -0
  55. data/config/locales/translations.fr.yml +21 -0
  56. data/config/locales/translations.it.yml +21 -0
  57. data/config/locales/translations.pt.yml +21 -0
  58. data/config/routes.rb +57 -0
  59. data/db/migrate/v1/0801000110_create_lesli_shield_accounts.rb +42 -0
  60. data/db/migrate/v1/0801050110_create_lesli_shield_dashboards.rb +51 -0
  61. data/db/migrate/v1/0801050210_create_lesli_shield_dashboard_components.rb +53 -0
  62. data/lib/lesli_shield/engine.rb +54 -0
  63. data/lib/lesli_shield/routing.rb +26 -0
  64. data/lib/lesli_shield/version.rb +4 -0
  65. data/lib/lesli_shield.rb +6 -0
  66. data/lib/scss/application.scss +0 -0
  67. data/lib/scss/confirmations.scss +58 -0
  68. data/lib/scss/devise/oauth.scss +34 -0
  69. data/lib/scss/passwords.scss +33 -0
  70. data/lib/scss/registrations.scss +35 -0
  71. data/lib/scss/sessions.scss +35 -0
  72. data/lib/tasks/lesli_shield_tasks.rake +4 -0
  73. data/lib/vue/application.js +76 -0
  74. data/lib/vue/apps/dashboards/components/engine-version.vue +71 -0
  75. data/lib/vue/confirmations.js +33 -0
  76. data/lib/vue/passwords.js +137 -0
  77. data/lib/vue/registrations.js +144 -0
  78. data/lib/vue/sessions.js +148 -0
  79. data/lib/vue/stores/translations.json +152 -0
  80. data/license +674 -0
  81. data/readme.md +71 -0
  82. metadata +168 -0
@@ -0,0 +1,96 @@
1
+ <%
2
+ =begin
3
+
4
+ Lesli
5
+
6
+ Copyright (c) 2023, Lesli Technologies, S. A.
7
+
8
+ This program is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 3 of the License, or
11
+ (at your option) any later version.
12
+
13
+ This program is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with this program. If not, see http://www.gnu.org/licenses/.
20
+
21
+ Lesli · Ruby on Rails SaaS Development Framework.
22
+
23
+ Made with ♥ by https://www.lesli.tech
24
+ Building a better future, one line of code at a time.
25
+
26
+ @contact hello@lesli.tech
27
+ @website https://www.lesli.tech
28
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
29
+
30
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
+ // ·
32
+ =end
33
+ %>
34
+
35
+ <% login = defined?(login) ? login : false %>
36
+ <% password_reset = defined?(password_reset) ? password_reset : false %>
37
+ <% magic_link = defined?(magic_link) ? magic_link : false %>
38
+ <% otp = defined?(otp) ? otp : false %>
39
+
40
+ <div class="links">
41
+
42
+ <% if login %>
43
+ <%= link_to(new_user_session_path) do %>
44
+ <span class="icon mr-1">
45
+ <svg xmlns="http://www.w3.org/2000/svg" width="23" height="17" fill="none" viewBox="0 0 23.441 17.473">
46
+ <path fill="#112a62" d="M6.253 2.41A6.253 6.253 0 0 0 .035 7.997a6.251 6.251 0 0 0 9.323 6.086 6.252 6.252 0 0 0 2.829-3.47h1.097v-.781h-.894a6.104 6.104 0 0 0 0-2.344h9.293l.879 1.172-.88 1.172h-.425l-1.055-1.059a.389.389 0 0 0-.554 0l-1.055 1.059h-.41l-.668-.997a.39.39 0 0 0-.649 0l-.668.997h-.57v.78h.781c.131 0 .252-.066.324-.175l.457-.684.457.684c.073.11.194.175.325.176h.78a.389.389 0 0 0 .278-.113l.895-.899.894.899a.388.388 0 0 0 .278.113h.78a.39.39 0 0 0 .313-.156l1.172-1.563a.39.39 0 0 0 0-.469L22.19 6.863a.39.39 0 0 0-.312-.156h-9.692A6.254 6.254 0 0 0 6.253 2.41Zm0 11.718c-.133 0-.261 0-.39-.02v-.76h.78v.76c-.128.02-.257.02-.39.02zM2.738 6.706h-.782v-.78h.782zm7.031-.78h.781v.78H9.77Zm-1.563 6.25h.782v.78h-.782zm-3.906.78H3.52v-.78H4.3zm6.25-1.562H9.77v-.781h.781ZM6.644 9.761v2.024h-.781V9.76a1.17 1.17 0 0 1-.711-.71H3.128v-.782h2.024a1.172 1.172 0 1 1 1.492 1.492zm-3.906 1.633h-.782v-.781h.782zm5.468-6.25v-.781h.782v.781zm-3.906 0H3.52v-.781H4.3zM1.566 8.269v.781H.804V8.27zm9.375.781V8.27h.781c0 .129.02.258.02.39 0 .133 0 .262-.02.391zM6.644 3.972h-.782v-.781h.781z"/>
47
+ <path fill="#112a62" d="m.134 2.09.492.61a8.595 8.595 0 0 1 10.973.125l.508-.594a9.372 9.372 0 0 0-11.973-.14ZM.69 14.774l-.492.609a9.38 9.38 0 0 0 11.973-.14l-.508-.594a8.596 8.596 0 0 1-10.972.125zM9.767 11.786v-.781h.782v.781z"/>
48
+ </svg>
49
+ </span>
50
+ <span>Login</span>
51
+ <% end %>
52
+ <% end %>
53
+
54
+ <% if password_reset %>
55
+ <%= link_to(new_user_password_path) do %>
56
+ <span class="icon mr-2">
57
+ <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
58
+ <path d="M10 4.75C8.55296 4.75 7.375 5.92796 7.375 7.375V8.25C6.89155 8.25 6.5 8.64155 6.5 9.125V13.5C6.5 13.9834 6.89155 14.375 7.375 14.375H12.625C13.1084 14.375 13.5 13.9834 13.5 13.5V9.125C13.5 8.64155 13.1084 8.25 12.625 8.25V7.375C12.625 5.92796 11.447 4.75 10 4.75ZM11.75 12.625H8.25V10H11.75V12.625ZM9.125 8.25V7.375C9.125 6.89264 9.51764 6.5 10 6.5C10.4824 6.5 10.875 6.89264 10.875 7.375V8.25H9.125Z" fill="#112A62"/>
59
+ <path d="M16.7549 3.14324C13.4431 -0.120437 8.34511 -0.489197 4.62839 2.0123L4.61745 0.577295C4.61526 0.336669 4.41839 0.141979 4.17667 0.143071L3.30167 0.149633C3.05996 0.151821 2.86527 0.348697 2.86745 0.590409L2.89151 3.86501C2.89479 4.21938 3.11026 4.53656 3.43729 4.67001C3.76542 4.80345 4.14056 4.72579 4.38993 4.47314C7.43941 1.3811 12.4343 1.34386 15.5264 4.39001C17.8867 6.71533 18.5308 10.2132 17.19 13.2111C17.0948 13.4244 17.1725 13.6738 17.3814 13.7799L18.1623 14.1791C18.3833 14.2917 18.6633 14.201 18.7661 13.9746C20.434 10.2996 19.6531 5.99904 16.7546 3.14304L16.7549 3.14324Z" fill="#112A62"/>
60
+ <path d="M16.5625 15.3296C16.2333 15.1962 15.8593 15.2739 15.6099 15.5265C12.5615 18.6197 7.56633 18.6569 4.47345 15.6096C2.11314 13.2843 1.46905 9.78647 2.80986 6.78851C2.90502 6.57523 2.82736 6.32587 2.61846 6.21978L1.83751 5.82055C1.61657 5.7079 1.33656 5.79868 1.23377 6.02509C-0.43528 9.70121 0.346732 14.0017 3.24518 16.8566C6.55702 20.1203 11.655 20.489 15.3717 17.9876L15.3826 19.4215C15.3848 19.6632 15.5817 19.8579 15.8234 19.8557L16.6984 19.8491C16.9401 19.8469 17.1348 19.6501 17.1326 19.4083L17.1086 16.1337C17.1053 15.7805 16.8898 15.4633 16.5628 15.3298L16.5625 15.3296Z" fill="#112A62"/>
61
+ </svg>
62
+ </span>
63
+ <span>Reset password</span>
64
+ <% end %>
65
+ <% end %>
66
+
67
+
68
+ <%# Dynamic check if instance allow users to login through magic links (passes) %>
69
+ <%# if Rails.application.config.lesli.dig(:security, :enable_login_link) %>
70
+ <% if magic_link %>
71
+ <%= link_to("pass_path") do %>
72
+ <span class="icon mr-1">
73
+ <svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
74
+ <path d="M17.5 7.25005H15.25C14.6748 7.25005 14.0996 7.34967 13.5498 7.52545C14.1748 8.00005 14.7002 8.57525 15.0996 9.25005H15.25H17.5C19.2998 9.25005 20.75 10.7003 20.75 12.5001C20.75 14.2999 19.2998 15.7501 17.5 15.7501H15.25C15.0996 15.7501 14.9248 15.7247 14.7754 15.7003H14.75C13.2002 15.4503 12 14.125 12 12.5C12 11.5 11.3496 10.6504 10.4502 10.375C10.1504 11.0254 10 11.75 10 12.5C10 15.4005 12.3496 17.75 15.25 17.75H17.5C20.4005 17.75 22.75 15.4004 22.75 12.5C22.75 9.5996 20.4004 7.25 17.5 7.25V7.25005Z" fill="#112A62"/>
75
+ <path d="M9.9248 15.7502H7.5C5.7002 15.7502 4.25 14.3 4.25 12.5002C4.25 10.7004 5.7002 9.25024 7.5 9.25024H9.75C11.5498 9.25024 13 10.7004 13 12.5002C13 13.5002 13.6504 14.3498 14.5498 14.6252C14.8496 13.9748 15 13.2502 15 12.5002C15 9.59974 12.6504 7.25024 9.75 7.25024H7.5C4.5995 7.25024 2.25 9.59984 2.25 12.5002C2.25 15.4006 4.5996 17.7502 7.5 17.7502H9.75C10.3252 17.7502 10.9004 17.6506 11.4502 17.4504C10.8496 17.0002 10.3252 16.4006 9.9248 15.7502Z" fill="#112A62"/>
76
+ </svg>
77
+ </span>
78
+ <span>Magic link</span>
79
+ <% end %>
80
+ <% end %>
81
+
82
+
83
+ <%# Dynamic check if instance allow users to login through one time passwords %>
84
+ <%# if Rails.application.config.lesli.dig(:security, :enable_login_otp) %>
85
+ <% if otp %>
86
+ <%= link_to("otp_path") do %>
87
+ <span class="icon mr-1">
88
+ <svg xmlns="http://www.w3.org/2000/svg" width="23" height="17" fill="none" viewBox="0 0 23.441 17.473">
89
+ <path fill="#112a62" d="M6.253 2.41A6.253 6.253 0 0 0 .035 7.997a6.251 6.251 0 0 0 9.323 6.086 6.252 6.252 0 0 0 2.829-3.47h1.097v-.781h-.894a6.104 6.104 0 0 0 0-2.344h9.293l.879 1.172-.88 1.172h-.425l-1.055-1.059a.389.389 0 0 0-.554 0l-1.055 1.059h-.41l-.668-.997a.39.39 0 0 0-.649 0l-.668.997h-.57v.78h.781c.131 0 .252-.066.324-.175l.457-.684.457.684c.073.11.194.175.325.176h.78a.389.389 0 0 0 .278-.113l.895-.899.894.899a.388.388 0 0 0 .278.113h.78a.39.39 0 0 0 .313-.156l1.172-1.563a.39.39 0 0 0 0-.469L22.19 6.863a.39.39 0 0 0-.312-.156h-9.692A6.254 6.254 0 0 0 6.253 2.41Zm0 11.718c-.133 0-.261 0-.39-.02v-.76h.78v.76c-.128.02-.257.02-.39.02zM2.738 6.706h-.782v-.78h.782zm7.031-.78h.781v.78H9.77Zm-1.563 6.25h.782v.78h-.782zm-3.906.78H3.52v-.78H4.3zm6.25-1.562H9.77v-.781h.781ZM6.644 9.761v2.024h-.781V9.76a1.17 1.17 0 0 1-.711-.71H3.128v-.782h2.024a1.172 1.172 0 1 1 1.492 1.492zm-3.906 1.633h-.782v-.781h.782zm5.468-6.25v-.781h.782v.781zm-3.906 0H3.52v-.781H4.3zM1.566 8.269v.781H.804V8.27zm9.375.781V8.27h.781c0 .129.02.258.02.39 0 .133 0 .262-.02.391zM6.644 3.972h-.782v-.781h.781z"/>
90
+ <path fill="#112a62" d="m.134 2.09.492.61a8.595 8.595 0 0 1 10.973.125l.508-.594a9.372 9.372 0 0 0-11.973-.14ZM.69 14.774l-.492.609a9.38 9.38 0 0 0 11.973-.14l-.508-.594a8.596 8.596 0 0 1-10.972.125zM9.767 11.786v-.781h.782v.781z"/>
91
+ </svg>
92
+ </span>
93
+ <span>One time password</span>
94
+ <% end %>
95
+ <% end %>
96
+ </div>
@@ -0,0 +1,16 @@
1
+ <h2>Resend unlock instructions</h2>
2
+
3
+ <%= form_for(resource, as: resource_name, url: unlock_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" %>
9
+ </div>
10
+
11
+ <div class="actions">
12
+ <%= f.submit "Resend unlock instructions" %>
13
+ </div>
14
+ <% end %>
15
+
16
+ <%= render "devise/shared/links" %>
@@ -0,0 +1,15 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Lesli shield</title>
5
+ <%= csrf_meta_tags %>
6
+ <%= csp_meta_tag %>
7
+
8
+ <%= stylesheet_link_tag "lesli_shield/application", media: "all" %>
9
+ </head>
10
+ <body>
11
+
12
+ <%= yield %>
13
+
14
+ </body>
15
+ </html>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1 @@
1
+ <router-view></router-view>
@@ -0,0 +1,336 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Assuming you have not yet modified this file, each configuration option below
4
+ # is set to its default value. Note that some are commented out while others
5
+ # are not: uncommented lines are intended to protect your configuration from
6
+ # breaking changes in upgrades (i.e., in the event that future versions of
7
+ # Devise change the default values for those options).
8
+ #
9
+ # Use this hook to configure devise mailer, warden hooks and so forth.
10
+ # Many of these configuration options can be set straight in your model.
11
+ Devise.setup do |config|
12
+ # The secret key used by Devise. Devise uses this key to generate
13
+ # random tokens. Changing this key will render invalid all existing
14
+ # confirmation, reset password and unlock tokens in the database.
15
+ # Devise will use the `secret_key_base` as its `secret_key`
16
+ # by default. You can change it below and use your own secret key.
17
+ # config.secret_key = '418b0e734e2cf533487ad8ee828e01e6482c597dd99cc9b1a11c35ae40ac8cfb1d89a17474d013f7f4dc1b1b92ba793688ecd92134fdd4cf8c08912d30e2a2e4'
18
+
19
+ # ==> Controller configuration
20
+ # Configure the parent class to the devise controllers.
21
+ # config.parent_controller = 'DeviseController'
22
+
23
+ # ==> Mailer Configuration
24
+ # Configure the e-mail address which will be shown in Devise::Mailer,
25
+ # note that it will be overwritten if you use your own mailer class
26
+ # with default "from" parameter.
27
+ config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
28
+
29
+ # Configure the class responsible to send e-mails.
30
+ # config.mailer = 'Devise::Mailer'
31
+
32
+ # Configure the parent class responsible to send e-mails.
33
+ # config.parent_mailer = 'ActionMailer::Base'
34
+
35
+ # ==> ORM configuration
36
+ # Load and configure the ORM. Supports :active_record (default) and
37
+ # :mongoid (bson_ext recommended) by default. Other ORMs may be
38
+ # available as additional gems.
39
+ require 'devise/orm/active_record'
40
+
41
+ # ==> Configuration for any authentication mechanism
42
+ # Configure which keys are used when authenticating a user. The default is
43
+ # just :email. You can configure it to use [:username, :subdomain], so for
44
+ # authenticating a user, both parameters are required. Remember that those
45
+ # parameters are used only when authenticating and not when retrieving from
46
+ # session. If you need permissions, you should implement that in a before filter.
47
+ # You can also supply a hash where the value is a boolean determining whether
48
+ # or not authentication should be aborted when the value is not present.
49
+ # config.authentication_keys = [:email]
50
+
51
+ # Configure parameters from the request object used for authentication. Each entry
52
+ # given should be a request method and it will automatically be passed to the
53
+ # find_for_authentication method and considered in your model lookup. For instance,
54
+ # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
55
+ # The same considerations mentioned for authentication_keys also apply to request_keys.
56
+ # config.request_keys = []
57
+
58
+ # Configure which authentication keys should be case-insensitive.
59
+ # These keys will be downcased upon creating or modifying a user and when used
60
+ # to authenticate or find a user. Default is :email.
61
+ config.case_insensitive_keys = [:email]
62
+
63
+ # Configure which authentication keys should have whitespace stripped.
64
+ # These keys will have whitespace before and after removed upon creating or
65
+ # modifying a user and when used to authenticate or find a user. Default is :email.
66
+ config.strip_whitespace_keys = [:email]
67
+
68
+ # Tell if authentication through request.params is enabled. True by default.
69
+ # It can be set to an array that will enable params authentication only for the
70
+ # given strategies, for example, `config.params_authenticatable = [:database]` will
71
+ # enable it only for database (email + password) authentication.
72
+ # config.params_authenticatable = true
73
+
74
+ # Tell if authentication through HTTP Auth is enabled. False by default.
75
+ # It can be set to an array that will enable http authentication only for the
76
+ # given strategies, for example, `config.http_authenticatable = [:database]` will
77
+ # enable it only for database authentication.
78
+ # For API-only applications to support authentication "out-of-the-box", you will likely want to
79
+ # enable this with :database unless you are using a custom strategy.
80
+ # The supported strategies are:
81
+ # :database = Support basic authentication with authentication key + password
82
+ # config.http_authenticatable = false
83
+
84
+ # If 401 status code should be returned for AJAX requests. True by default.
85
+ # config.http_authenticatable_on_xhr = true
86
+
87
+ # The realm used in Http Basic Authentication. 'Application' by default.
88
+ # config.http_authentication_realm = 'Application'
89
+
90
+ # It will change confirmation, password recovery and other workflows
91
+ # to behave the same regardless if the e-mail provided was right or wrong.
92
+ # Does not affect registerable.
93
+ # config.paranoid = true
94
+
95
+ # By default Devise will store the user in session. You can skip storage for
96
+ # particular strategies by setting this option.
97
+ # Notice that if you are skipping storage for all authentication paths, you
98
+ # may want to disable generating routes to Devise's sessions controller by
99
+ # passing skip: :sessions to `devise_for` in your config/routes.rb
100
+ config.skip_session_storage = [:http_auth]
101
+
102
+ # By default, Devise cleans up the CSRF token on authentication to
103
+ # avoid CSRF token fixation attacks. This means that, when using AJAX
104
+ # requests for sign in and sign up, you need to get a new CSRF token
105
+ # from the server. You can disable this option at your own risk.
106
+ # config.clean_up_csrf_token_on_authentication = true
107
+
108
+ # When false, Devise will not attempt to reload routes on eager load.
109
+ # This can reduce the time taken to boot the app but if your application
110
+ # requires the Devise mappings to be loaded during boot time the application
111
+ # won't boot properly.
112
+ # config.reload_routes = true
113
+
114
+ # ==> Configuration for :database_authenticatable
115
+ # For bcrypt, this is the cost for hashing the password and defaults to 12. If
116
+ # using other algorithms, it sets how many times you want the password to be hashed.
117
+ # The number of stretches used for generating the hashed password are stored
118
+ # with the hashed password. This allows you to change the stretches without
119
+ # invalidating existing passwords.
120
+ #
121
+ # Limiting the stretches to just one in testing will increase the performance of
122
+ # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
123
+ # a value less than 10 in other environments. Note that, for bcrypt (the default
124
+ # algorithm), the cost increases exponentially with the number of stretches (e.g.
125
+ # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
126
+ config.stretches = Rails.env.test? ? 1 : 12
127
+
128
+ # Set up a pepper to generate the hashed password.
129
+ # config.pepper = '8c4f31eaa01bedfc975c738b6e0492844f2e2f4d68229ebd206cc6d6752ea4dda7df27d34a958150f6f7ff57f647889376f846715242a8715651765d02acd086'
130
+
131
+ # Send a notification to the original email when the user's email is changed.
132
+ # config.send_email_changed_notification = false
133
+
134
+ # Send a notification email when the user's password is changed.
135
+ # config.send_password_change_notification = false
136
+
137
+ # ==> Configuration for :confirmable
138
+ # A period that the user is allowed to access the website even without
139
+ # confirming their account. For instance, if set to 2.days, the user will be
140
+ # able to access the website for two days without confirming their account,
141
+ # access will be blocked just in the third day.
142
+ # You can also set it to nil, which will allow the user to access the website
143
+ # without confirming their account.
144
+ # Default is 0.days, meaning the user cannot access the website without
145
+ # confirming their account.
146
+ # config.allow_unconfirmed_access_for = 2.days
147
+
148
+ # A period that the user is allowed to confirm their account before their
149
+ # token becomes invalid. For example, if set to 3.days, the user can confirm
150
+ # their account within 3 days after the mail was sent, but on the fourth day
151
+ # their account can't be confirmed with the token any more.
152
+ # Default is nil, meaning there is no restriction on how long a user can take
153
+ # before confirming their account.
154
+ # config.confirm_within = 3.days
155
+
156
+ # If true, requires any email changes to be confirmed (exactly the same way as
157
+ # initial account confirmation) to be applied. Requires additional unconfirmed_email
158
+ # db field (see migrations). Until confirmed, new email is stored in
159
+ # unconfirmed_email column, and copied to email column on successful confirmation.
160
+ config.reconfirmable = true
161
+
162
+ # Defines which key will be used when confirming an account
163
+ # config.confirmation_keys = [:email]
164
+
165
+ # ==> Configuration for :rememberable
166
+ # The time the user will be remembered without asking for credentials again.
167
+ # config.remember_for = 2.weeks
168
+
169
+ # Invalidates all the remember me tokens when the user signs out.
170
+ config.expire_all_remember_me_on_sign_out = true
171
+
172
+ # If true, extends the user's remember period when remembered via cookie.
173
+ # config.extend_remember_period = false
174
+
175
+ # Options to be passed to the created cookie. For instance, you can set
176
+ # secure: true in order to force SSL only cookies.
177
+ # config.rememberable_options = {}
178
+
179
+ # ==> Configuration for :validatable
180
+ # Range for password length.
181
+ config.password_length = 6..128
182
+
183
+ # Email regex used to validate email formats. It simply asserts that
184
+ # one (and only one) @ exists in the given string. This is mainly
185
+ # to give user feedback and not to assert the e-mail validity.
186
+ config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
187
+
188
+ # ==> Configuration for :timeoutable
189
+ # The time you want to timeout the user session without activity. After this
190
+ # time the user will be asked for credentials again. Default is 30 minutes.
191
+ # config.timeout_in = 30.minutes
192
+
193
+ # ==> Configuration for :lockable
194
+ # Defines which strategy will be used to lock an account.
195
+ # :failed_attempts = Locks an account after a number of failed attempts to sign in.
196
+ # :none = No lock strategy. You should handle locking by yourself.
197
+ # config.lock_strategy = :failed_attempts
198
+
199
+ # Defines which key will be used when locking and unlocking an account
200
+ # config.unlock_keys = [:email]
201
+
202
+ # Defines which strategy will be used to unlock an account.
203
+ # :email = Sends an unlock link to the user email
204
+ # :time = Re-enables login after a certain amount of time (see :unlock_in below)
205
+ # :both = Enables both strategies
206
+ # :none = No unlock strategy. You should handle unlocking by yourself.
207
+ # config.unlock_strategy = :both
208
+
209
+ # Number of authentication tries before locking an account if lock_strategy
210
+ # is failed attempts.
211
+ # config.maximum_attempts = 20
212
+
213
+ # Time interval to unlock the account if :time is enabled as unlock_strategy.
214
+ # config.unlock_in = 1.hour
215
+
216
+ # Warn on the last attempt before the account is locked.
217
+ # config.last_attempt_warning = true
218
+
219
+ # ==> Configuration for :recoverable
220
+ #
221
+ # Defines which key will be used when recovering the password for an account
222
+ # config.reset_password_keys = [:email]
223
+
224
+ # Time interval you can reset your password with a reset password key.
225
+ # Don't put a too small interval or your users won't have the time to
226
+ # change their passwords.
227
+ config.reset_password_within = 6.hours
228
+
229
+ # When set to false, does not sign a user in automatically after their password is
230
+ # reset. Defaults to true, so a user is signed in automatically after a reset.
231
+ # config.sign_in_after_reset_password = true
232
+
233
+ # ==> Configuration for :encryptable
234
+ # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
235
+ # You can use :sha1, :sha512 or algorithms from others authentication tools as
236
+ # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
237
+ # for default behavior) and :restful_authentication_sha1 (then you should set
238
+ # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
239
+ #
240
+ # Require the `devise-encryptable` gem when using anything other than bcrypt
241
+ # config.encryptor = :sha512
242
+
243
+ # ==> Scopes configuration
244
+ # Turn scoped views on. Before rendering "sessions/new", it will first check for
245
+ # "users/sessions/new". It's turned off by default because it's slower if you
246
+ # are using only default views.
247
+ # config.scoped_views = false
248
+
249
+ # Configure the default scope given to Warden. By default it's the first
250
+ # devise role declared in your routes (usually :user).
251
+ # config.default_scope = :user
252
+
253
+ # Set this configuration to false if you want /users/sign_out to sign out
254
+ # only the current scope. By default, Devise signs out all scopes.
255
+ # config.sign_out_all_scopes = true
256
+
257
+ # ==> Navigation configuration
258
+ # Lists the formats that should be treated as navigational. Formats like
259
+ # :html should redirect to the sign in page when the user does not have
260
+ # access, but formats like :xml or :json, should return 401.
261
+ #
262
+ # If you have any extra navigational formats, like :iphone or :mobile, you
263
+ # should add them to the navigational formats lists.
264
+ #
265
+ # The "*/*" below is required to match Internet Explorer requests.
266
+ # config.navigational_formats = ['*/*', :html, :turbo_stream]
267
+
268
+ # The default HTTP method used to sign out a resource. Default is :delete.
269
+ config.sign_out_via = :delete
270
+
271
+ # ==> OmniAuth
272
+ # Add a new OmniAuth provider. Check the wiki for more information on setting
273
+ # up on your models and hooks.
274
+ # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
275
+
276
+ # ==> Warden configuration
277
+ # If you want to use other strategies, that are not supported by Devise, or
278
+ # change the failure app, you can configure them inside the config.warden block.
279
+ #
280
+ # config.warden do |manager|
281
+ # manager.intercept_401 = false
282
+ # manager.default_strategies(scope: :user).unshift :some_external_strategy
283
+ # end
284
+
285
+ # ==> Mountable engine configurations
286
+ # When using Devise inside an engine, let's call it `MyEngine`, and this engine
287
+ # is mountable, there are some extra configurations to be taken into account.
288
+ # The following options are available, assuming the engine is mounted as:
289
+ #
290
+ # mount MyEngine, at: '/my_engine'
291
+ #
292
+ # The router that invoked `devise_for`, in the example above, would be:
293
+ # config.router_name = :my_engine
294
+ #
295
+ # When using OmniAuth, Devise cannot automatically set OmniAuth path,
296
+ # so you need to do it manually. For the users scope, it would be:
297
+ # config.omniauth_path_prefix = '/my_engine/users/auth'
298
+
299
+ # ==> Hotwire/Turbo configuration
300
+ # When using Devise with Hotwire/Turbo, the http status for error responses
301
+ # and some redirects must match the following. The default in Devise for existing
302
+ # apps is `200 OK` and `302 Found respectively`, but new apps are generated with
303
+ # these new defaults that match Hotwire/Turbo behavior.
304
+ # Note: These might become the new default in future versions of Devise.
305
+ # config.responder.error_status = :unprocessable_entity
306
+ # config.responder.redirect_status = :see_other
307
+
308
+ # ==> Configuration for :registerable
309
+
310
+ # When set to false, does not sign a user in automatically after their password is
311
+ # changed. Defaults to true, so a user is signed in automatically after changing a password.
312
+ # config.sign_in_after_change_password = true
313
+ end
314
+
315
+
316
+ Devise.setup do |config|
317
+
318
+ config.mailer = "Lesli::DeviseMailer"
319
+
320
+ # Mount devise through Lesli engine
321
+ config.router_name = :lesli_shield
322
+
323
+ # ==> Controller configuration
324
+ # Configure the parent class to the devise controllers.
325
+ config.parent_controller = "Lesli::ApplicationDeviseController"
326
+
327
+ # The default HTTP method used to sign out a resource. Default is :delete.
328
+ config.sign_out_via = :get
329
+
330
+ # If 401 status code should be returned for AJAX requests. True by default.
331
+ config.http_authenticatable_on_xhr = false
332
+
333
+ # The "*/*" below is required to match Internet Explorer requests.
334
+ config.navigational_formats = [:html, :json]
335
+ end
336
+
@@ -0,0 +1,21 @@
1
+ ---
2
+ :en:
3
+ lesli:
4
+ shared:
5
+ view_discussions: Discussions
6
+ button_add_new: Add new
7
+ button_reload: Reload
8
+ view_files: Files
9
+ view_quick_actions: Quick actions
10
+ button_list: List
11
+ button_save: Save
12
+ button_delete: Delete
13
+ button_edit: Edit
14
+ view_status_active: Active
15
+ view_status_inactive: Inactive
16
+ button_settings: Settings
17
+ button_show: Show
18
+ toolbar_search: Search...
19
+ application:
20
+ navigation_logout: Logout
21
+ navigation_my_profile: My profile
@@ -0,0 +1,21 @@
1
+ ---
2
+ :es:
3
+ lesli:
4
+ shared:
5
+ view_discussions: Discusiones
6
+ button_add_new: Agregar nuevo
7
+ button_reload: Recargar
8
+ view_files: Archivos
9
+ view_quick_actions: Acciones rapidas
10
+ button_list: Lista
11
+ button_save: Guardar
12
+ button_delete: Eliminar
13
+ button_edit: Editar
14
+ view_status_active: Activo
15
+ view_status_inactive: Inactivo
16
+ button_settings: Configuración
17
+ button_show: Ver
18
+ toolbar_search: Buscar...
19
+ application:
20
+ navigation_logout: Cerrar sesión
21
+ navigation_my_profile: Mi perfil
@@ -0,0 +1,21 @@
1
+ ---
2
+ :fr:
3
+ lesli:
4
+ shared:
5
+ view_discussions: ":lesli.shared.view_discussions:"
6
+ button_add_new: ":lesli.shared.button_add_new:"
7
+ button_reload: ":lesli.shared.button_reload:"
8
+ view_files: ":lesli.shared.view_files:"
9
+ view_quick_actions: ":lesli.shared.view_quick_actions:"
10
+ button_list: ":lesli.shared.button_list:"
11
+ button_save: ":lesli.shared.button_save:"
12
+ button_delete: ":lesli.shared.button_delete:"
13
+ button_edit: ":lesli.shared.button_edit:"
14
+ view_status_active: ":lesli.shared.view_status_active:"
15
+ view_status_inactive: ":lesli.shared.view_status_inactive:"
16
+ button_settings: ":lesli.shared.button_settings:"
17
+ button_show: ":lesli.shared.button_show:"
18
+ toolbar_search: ":lesli.shared.toolbar_search:"
19
+ application:
20
+ navigation_logout: ":lesli.application.navigation_logout:"
21
+ navigation_my_profile: ":lesli.application.navigation_my_profile:"
@@ -0,0 +1,21 @@
1
+ ---
2
+ :it:
3
+ lesli:
4
+ shared:
5
+ view_discussions: ":lesli.shared.view_discussions:"
6
+ button_add_new: ":lesli.shared.button_add_new:"
7
+ button_reload: ":lesli.shared.button_reload:"
8
+ view_files: ":lesli.shared.view_files:"
9
+ view_quick_actions: ":lesli.shared.view_quick_actions:"
10
+ button_list: ":lesli.shared.button_list:"
11
+ button_save: ":lesli.shared.button_save:"
12
+ button_delete: ":lesli.shared.button_delete:"
13
+ button_edit: ":lesli.shared.button_edit:"
14
+ view_status_active: ":lesli.shared.view_status_active:"
15
+ view_status_inactive: ":lesli.shared.view_status_inactive:"
16
+ button_settings: ":lesli.shared.button_settings:"
17
+ button_show: ":lesli.shared.button_show:"
18
+ toolbar_search: ":lesli.shared.toolbar_search:"
19
+ application:
20
+ navigation_logout: ":lesli.application.navigation_logout:"
21
+ navigation_my_profile: ":lesli.application.navigation_my_profile:"
@@ -0,0 +1,21 @@
1
+ ---
2
+ :pt:
3
+ lesli:
4
+ shared:
5
+ view_discussions: ":lesli.shared.view_discussions:"
6
+ button_add_new: ":lesli.shared.button_add_new:"
7
+ button_reload: ":lesli.shared.button_reload:"
8
+ view_files: ":lesli.shared.view_files:"
9
+ view_quick_actions: ":lesli.shared.view_quick_actions:"
10
+ button_list: ":lesli.shared.button_list:"
11
+ button_save: ":lesli.shared.button_save:"
12
+ button_delete: ":lesli.shared.button_delete:"
13
+ button_edit: ":lesli.shared.button_edit:"
14
+ view_status_active: ":lesli.shared.view_status_active:"
15
+ view_status_inactive: ":lesli.shared.view_status_inactive:"
16
+ button_settings: ":lesli.shared.button_settings:"
17
+ button_show: ":lesli.shared.button_show:"
18
+ toolbar_search: ":lesli.shared.toolbar_search:"
19
+ application:
20
+ navigation_logout: ":lesli.application.navigation_logout:"
21
+ navigation_my_profile: ":lesli.application.navigation_my_profile:"
data/config/routes.rb ADDED
@@ -0,0 +1,57 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2023, Lesli Technologies, S. A.
6
+
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU General Public License for more details.
16
+
17
+ You should have received a copy of the GNU General Public License
18
+ along with this program. If not, see http://www.gnu.org/licenses/.
19
+
20
+ Lesli · Ruby on Rails SaaS Development Framework.
21
+
22
+ Made with ♥ by https://www.lesli.tech
23
+ Building a better future, one line of code at a time.
24
+
25
+ @contact hello@lesli.tech
26
+ @website https://www.lesli.tech
27
+ @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
28
+
29
+ // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
30
+ // ·
31
+ =end
32
+
33
+
34
+ # Mount the devise at the deefault path
35
+ # TODO:
36
+ # The user can define the mount path for the auth framework
37
+ # using: "Lesli::Routing.mount_login_at('auth')" so, later
38
+ # we will must to check if devise is already mounted before
39
+ # to call this method.
40
+ LesliShield::Routing.mount_login
41
+
42
+
43
+ # ·
44
+ LesliShield::Engine.routes.draw do
45
+ root to: "dashboards#show"
46
+
47
+ resource :dashboard, only: [:show]
48
+ resources :dashboards do
49
+ collection do
50
+ post "list" => :index
51
+ get :options
52
+ end
53
+ scope module: :dashboard do
54
+ resources :components
55
+ end
56
+ end
57
+ end