lesli_shield 1.1.3 → 1.1.4

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.
@@ -1 +1,31 @@
1
+ @charset "UTF-8";
2
+ /*
3
+ Lesli
1
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
+ */
@@ -126,7 +126,7 @@ class Users::SessionsController < Devise::SessionsController
126
126
  # Ensures it's a local path
127
127
  return redirect_path if uri.relative?
128
128
  end
129
- Lesli.config.path_after_login || root_path
129
+ Lesli.config.shield.dig(:path_after_login) || root_path
130
130
  rescue URI::InvalidURIError
131
131
  # If the URL is invalid, fallback to root
132
132
  root_path
@@ -59,36 +59,31 @@ module LesliShield
59
59
  # check if instance is for multi-account
60
60
  allow_multiaccount = Lesli.config.security.dig(:allow_multiaccount)
61
61
 
62
- # create new account for the new user only if multi-account is allowed
63
62
  if allow_multiaccount === true
63
+ # create new account for the new user only if multi-account is allowed
64
64
  account = Lesli::Account.create!({
65
65
  user: resource, # set user as owner of his just created account
66
66
  name: "Lesli", # temporary company name
67
67
  email: resource.email,
68
68
  status: :active # account is active due user already confirmed his email
69
69
  })
70
- end
71
-
72
- # if multi-account is not allowed user belongs to the first account in instance
73
- if allow_multiaccount === false
70
+ else
71
+ # if multi-account is not allowed user belongs to the first account in instance
74
72
  account = Lesli::Account.first
75
73
  end
76
74
 
77
75
  # add user to his own account
78
76
  resource.account = account
79
-
80
- # add owner role to user only if multi-account is allowed
77
+
81
78
  if allow_multiaccount == true
79
+ # add owner role to user only if multi-account is allowed
82
80
  resource.user_roles.create({ role: account.roles.find_by(name: "owner") })
83
- end
84
-
85
- # add profile role to user only if multi-account is allowed
86
- if allow_multiaccount == false
81
+ else
87
82
  # Assigning default role if defined in account settings
88
83
  # Otherwise, the default role is "limited"
89
84
  #default_role_id = account.settings.find_by(:name => "default_role_id")&.value
90
- default_role_id = nil
91
-
85
+ default_role_id = Lesli.config.shield.dig(:default_role)
86
+
92
87
  if default_role_id.present?
93
88
  resource.roles.create({ role: account.roles.find_by(:id => default_role_id)})
94
89
  else
@@ -38,7 +38,12 @@ if Lesli.config.demo
38
38
  end
39
39
  %>
40
40
 
41
- <%= render("devise/shared/application-devise", title:"Create an account to discover Lesli") do %>
41
+ <%
42
+ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
43
+ default: :"lesli_shield.devise/registrations.view_title")
44
+ %>
45
+
46
+ <%= render("devise/shared/application-devise", title:title) do %>
42
47
 
43
48
  <%= form_for(
44
49
  resource,
@@ -63,17 +68,11 @@ end
63
68
  ) %>
64
69
 
65
70
  <div class="field mb-5">
66
- <p>Password needs to contain:</p>
71
+ <p><%= I18n.t("lesli_shield.devise/registrations.view_password_requirements") %></p>
67
72
  <ul class="pl-3 password-requirements">
68
- <li>
69
- &bull; Minimum one uppercase letter
70
- </li>
71
- <li>
72
- &bull; One symbol
73
- </li>
74
- <li>
75
- &bull; One number
76
- </li>
73
+ <li>&bull; <%= I18n.t("lesli_shield.devise/registrations.view_password_requirements_uppercase") %></li>
74
+ <li>&bull; <%= I18n.t("lesli_shield.dashboards.view_password_requirements_symbol") %></li>
75
+ <li>&bull; <%= I18n.t("lesli_shield.dashboards.view_password_requirements_number") %></li>
77
76
  </ul>
78
77
  </div>
79
78
 
@@ -89,15 +88,16 @@ end
89
88
  <button
90
89
  type="submit"
91
90
  class="button is-primary is-fullwidth mb-2">
92
- Create account
91
+ <%= I18n.t("overrides.lesli_shield.devise/registrations.button_create_account",
92
+ default: :"lesli_shield.devise/registrations.button_create_account") %>
93
93
  </button>
94
94
  </div>
95
95
  </div>
96
96
 
97
97
  <p class="account has-text-centered">
98
- Already have an account?
98
+ <%= I18n.t("lesli_shield.devise/registrations.view_already_have_an_account") %>
99
99
  <%= link_to(new_user_session_path, :class => "has-text-primary") do %>
100
- <u><b>Log in</b></u>
100
+ <u><b><%= I18n.t("lesli_shield.devise/registrations.button_login") %></b></u>
101
101
  <% end %>
102
102
  </p>
103
103
  <% end %>
@@ -39,7 +39,12 @@ if Lesli.config.demo
39
39
  end
40
40
  %>
41
41
 
42
- <%= render("devise/shared/application-devise", title:"Welcome to Lesli") do %>
42
+ <%
43
+ title = I18n.t("overrides.lesli_shield.devise/sessions.view_title",
44
+ default: :"lesli_shield.devise/sessions.view_title")
45
+ %>
46
+
47
+ <%= render("devise/shared/application-devise", title:title) do %>
43
48
 
44
49
  <%= form_for(
45
50
  resource,
@@ -77,16 +82,16 @@ end
77
82
  <button
78
83
  type="submit"
79
84
  class="button is-primary is-fullwidth mb-2">
80
- Log in
85
+ <%= I18n.t("lesli_shield.devise/sessions.button_log_in") %>
81
86
  </button>
82
87
  </div>
83
88
  </div>
84
89
 
85
90
  <% if Lesli.config.security.dig(:allow_registration) %>
86
91
  <p class="account has-text-centered">
87
- Still not registered?
92
+ <%= I18n.t("lesli_shield.devise/sessions.view_still_not_registered") %>
88
93
  <%= link_to(new_user_registration_path, :class => "has-text-primary") do %>
89
- <u><b>Create account</b></u>
94
+ <u><b><%= I18n.t("lesli_shield.devise/sessions.button_create_account") %></b></u>
90
95
  <% end %>
91
96
  </p>
92
97
  <% end %>
@@ -59,7 +59,6 @@ Building a better future, one line of code at a time.
59
59
  :alt => "Main logo")
60
60
  %>
61
61
  <h1 class="is-title is-size-3 has-text-primary">
62
- <%#= I18n.t("core.users/sessions.view_text_welcome") %>
63
62
  <%= title %>
64
63
  </h1>
65
64
  </div>
@@ -3,3 +3,17 @@
3
3
  lesli_shield:
4
4
  devise/sessions:
5
5
  message_not_valid_credentials: Not valid credentials
6
+ view_title: Welcome to Lesli
7
+ button_log_in: Log in
8
+ view_still_not_registered: Still not registered?
9
+ button_create_account: Create account
10
+ devise/registrations:
11
+ view_title: Create an account to discover Lesli
12
+ view_password_requirements: 'Password needs to contain:'
13
+ view_password_requirements_uppercase: 'Minimum one uppercase letter '
14
+ button_create_account: Create account
15
+ view_already_have_an_account: Already have an account?
16
+ button_login: Log in
17
+ dashboards:
18
+ view_password_requirements_symbol: One symbol
19
+ view_password_requirements_number: One number
@@ -3,3 +3,17 @@
3
3
  lesli_shield:
4
4
  devise/sessions:
5
5
  message_not_valid_credentials: Credenciales no validas
6
+ view_title: ":lesli_shield.devise/sessions.view_title:"
7
+ button_log_in: Iniciar sesión
8
+ view_still_not_registered: "¿Aún no tienes cuenta?"
9
+ button_create_account: Crear cuenta
10
+ devise/registrations:
11
+ view_title: Crea una cuenta y descubre Lesli
12
+ view_password_requirements: 'La contraseña debe incluir:'
13
+ view_password_requirements_uppercase: Una letra mayuscula
14
+ button_create_account: Crear cuenta
15
+ view_already_have_an_account: "¿Ya tienes cuenta?"
16
+ button_login: Iniciar sesión
17
+ dashboards:
18
+ view_password_requirements_symbol: Un caracter especial
19
+ view_password_requirements_number: Un número
@@ -1,4 +1,4 @@
1
1
  module LesliShield
2
- VERSION = "1.1.3"
3
- BUILD = "1777771350"
2
+ VERSION = "1.1.4"
3
+ BUILD = "1780272810"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_shield
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
@@ -163,9 +163,6 @@ files:
163
163
  - config/initializers/devise.rb
164
164
  - config/locales/translations.en.yml
165
165
  - config/locales/translations.es.yml
166
- - config/locales/translations.fr.yml
167
- - config/locales/translations.it.yml
168
- - config/locales/translations.pt.yml
169
166
  - config/routes.rb
170
167
  - db/migrate/v1/0801000110_create_lesli_shield_accounts.rb
171
168
  - db/migrate/v1/0801100210_create_lesli_shield_role_actions.rb
@@ -1,2 +0,0 @@
1
- ---
2
- :fr: {}
@@ -1,5 +0,0 @@
1
- ---
2
- :it:
3
- lesli_shield:
4
- devise/sessions:
5
- message_not_valid_credentials: ":lesli_shield.devise/sessions.message_not_valid_credentials:"
@@ -1,2 +0,0 @@
1
- ---
2
- :pt: {}