lesli_shield 0.1.1 → 1.0.1

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.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/lesli_shield/application.js +1 -4415
  3. data/app/assets/javascripts/lesli_shield/confirmations.js +1 -47
  4. data/app/assets/javascripts/lesli_shield/passwords.js +1 -699
  5. data/app/assets/javascripts/lesli_shield/registrations.js +1 -699
  6. data/app/assets/javascripts/lesli_shield/sessions.js +1 -699
  7. data/app/assets/stylesheets/lesli_shield/application.css +0 -3
  8. data/app/assets/stylesheets/lesli_shield/confirmations.css +0 -25828
  9. data/app/assets/stylesheets/lesli_shield/devise/oauth.css +1 -0
  10. data/app/assets/stylesheets/lesli_shield/passwords.css +1 -25812
  11. data/app/assets/stylesheets/lesli_shield/registrations.css +1 -26168
  12. data/app/assets/stylesheets/lesli_shield/sessions.css +1 -26168
  13. data/app/assets/stylesheets/lesli_shield/users.css +1 -0
  14. data/app/controllers/lesli_shield/application_controller.rb +2 -2
  15. data/app/controllers/lesli_shield/dashboards_controller.rb +8 -1
  16. data/app/controllers/lesli_shield/role/actions_controller.rb +46 -0
  17. data/app/controllers/lesli_shield/roles_controller.rb +182 -0
  18. data/app/controllers/lesli_shield/sessions_controller.rb +67 -0
  19. data/app/controllers/lesli_shield/settings_controller.rb +61 -0
  20. data/app/controllers/lesli_shield/users_controller.rb +90 -0
  21. data/app/controllers/users/confirmations_controller.rb +2 -1
  22. data/app/controllers/users/passwords_controller.rb +31 -35
  23. data/app/controllers/users/registrations_controller.rb +28 -33
  24. data/app/controllers/users/sessions_controller.rb +38 -48
  25. data/app/helpers/lesli_shield/sessions_helper.rb +4 -0
  26. data/app/helpers/lesli_shield/settings_helper.rb +4 -0
  27. data/app/helpers/lesli_shield/users_helper.rb +4 -0
  28. data/app/interfaces/lesli_shield/authentication_interface.rb +64 -0
  29. data/app/interfaces/lesli_shield/authorization_interface.rb +40 -0
  30. data/{db/migrate/v1/0801050210_create_lesli_shield_dashboard_components.rb → app/models/lesli_shield/account.rb} +8 -18
  31. data/app/models/lesli_shield/application_record.rb +3 -3
  32. data/app/models/lesli_shield/setting.rb +4 -0
  33. data/app/models/lesli_shield/user.rb +5 -0
  34. data/app/services/lesli_shield/tokens.rb +39 -0
  35. data/app/views/devise/confirmations/new.html.erb +14 -0
  36. data/app/views/devise/passwords/edit.html.erb +27 -69
  37. data/app/views/devise/passwords/new.html.erb +31 -73
  38. data/app/views/devise/registrations/new.html.erb +43 -97
  39. data/app/views/devise/sessions/new.html.erb +48 -68
  40. data/app/views/devise/shared/_demo.html.erb +6 -7
  41. data/app/views/devise/shared/_error_messages.html.erb +27 -13
  42. data/app/views/devise/shared/_links.html.erb +1 -1
  43. data/app/views/lesli_shield/dashboards/index.html.erb +8 -0
  44. data/app/views/lesli_shield/dashboards/show.html.erb +1 -1
  45. data/app/views/lesli_shield/partials/_navigation.html.erb +39 -0
  46. data/app/views/lesli_shield/roles/_form-information.html.erb +21 -0
  47. data/app/views/lesli_shield/roles/_form-privileges.html.erb +104 -0
  48. data/app/views/lesli_shield/roles/_session.html.erb +2 -0
  49. data/app/views/lesli_shield/roles/edit.html.erb +12 -0
  50. data/app/views/lesli_shield/roles/index.html.erb +45 -0
  51. data/app/views/lesli_shield/roles/new.html.erb +11 -0
  52. data/app/views/lesli_shield/roles/show.html.erb +13 -0
  53. data/app/views/lesli_shield/roles/update.turbo_stream.erb +3 -0
  54. data/app/views/lesli_shield/sessions/_form.html.erb +17 -0
  55. data/app/views/lesli_shield/sessions/_session.html.erb +2 -0
  56. data/app/views/lesli_shield/sessions/edit.html.erb +12 -0
  57. data/app/views/lesli_shield/sessions/index.html.erb +37 -0
  58. data/app/views/lesli_shield/sessions/new.html.erb +11 -0
  59. data/app/views/lesli_shield/sessions/show.html.erb +6 -0
  60. data/app/views/lesli_shield/settings/_form.html.erb +17 -0
  61. data/app/views/lesli_shield/settings/_setting.html.erb +2 -0
  62. data/app/views/lesli_shield/settings/edit.html.erb +12 -0
  63. data/app/views/lesli_shield/settings/index.html.erb +16 -0
  64. data/app/views/lesli_shield/settings/new.html.erb +11 -0
  65. data/app/views/lesli_shield/settings/show.html.erb +9 -0
  66. data/app/views/lesli_shield/users/_information-card.html.erb +49 -0
  67. data/app/views/lesli_shield/users/_information-form.html.erb +12 -0
  68. data/app/views/lesli_shield/users/_management-sessions.html.erb +27 -0
  69. data/app/views/lesli_shield/users/_viewer-activities.html.erb +5 -0
  70. data/app/views/lesli_shield/users/edit.html.erb +0 -0
  71. data/app/views/lesli_shield/users/index.html.erb +45 -0
  72. data/app/views/lesli_shield/users/new.html.erb +11 -0
  73. data/app/views/lesli_shield/users/show.html.erb +27 -0
  74. data/app/views/lesli_shield/users/update.turbo_stream.erb +3 -0
  75. data/config/locales/translations.en.yml +1 -22
  76. data/config/locales/translations.es.yml +1 -22
  77. data/config/locales/translations.fr.yml +1 -22
  78. data/config/locales/translations.it.yml +1 -22
  79. data/config/locales/translations.pt.yml +1 -22
  80. data/config/routes.rb +31 -7
  81. data/db/migrate/v1/0801000110_create_lesli_shield_accounts.rb +3 -8
  82. data/db/migrate/v1/0801001710_create_lesli_shield_settings.rb +37 -0
  83. data/db/migrate/v1/{0801050110_create_lesli_shield_dashboards.rb → 0801003010_create_lesli_shield_dashboards.rb} +3 -17
  84. data/db/migrate/v1/0801120310_create_lesli_shield_user_shortcuts.rb +44 -0
  85. data/db/migrate/v1/0801120410_create_lesli_shield_user_tokens.rb +46 -0
  86. data/lib/lesli_shield/engine.rb +1 -5
  87. data/lib/lesli_shield/routing.rb +0 -3
  88. data/lib/lesli_shield/version.rb +2 -2
  89. data/lib/scss/_devise-simple.scss +90 -0
  90. data/lib/scss/_devise.scss +162 -0
  91. data/lib/scss/application.scss +6 -0
  92. data/lib/scss/confirmations.scss +24 -24
  93. data/lib/scss/devise/oauth.scss +1 -1
  94. data/lib/scss/passwords.scss +4 -2
  95. data/lib/scss/registrations.scss +2 -2
  96. data/lib/scss/sessions.scss +2 -2
  97. data/lib/scss/users.scss +58 -0
  98. data/lib/tasks/lesli_shield_tasks.rake +49 -4
  99. data/lib/vue/application.js +7 -0
  100. data/lib/vue/apps/sessions/index.vue +50 -0
  101. data/lib/vue/stores/sessions.js +43 -0
  102. data/readme.md +32 -18
  103. metadata +67 -15
  104. data/app/views/layouts/lesli_shield/application.html.erb +0 -15
@@ -1,10 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
1
  =begin
4
2
 
5
3
  Lesli
6
4
 
7
- Copyright (c) 2023, Lesli Technologies, S. A.
5
+ Copyright (c) 2025, Lesli Technologies, S. A.
8
6
 
9
7
  This program is free software: you can redistribute it and/or modify
10
8
  it under the terms of the GNU General Public License as published by
@@ -21,7 +19,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
21
19
 
22
20
  Lesli · Ruby on Rails SaaS Development Framework.
23
21
 
24
- Made with ♥ by https://www.lesli.tech
22
+ Made with ♥ by LesliTech
25
23
  Building a better future, one line of code at a time.
26
24
 
27
25
  @contact hello@lesli.tech
@@ -32,37 +30,34 @@ Building a better future, one line of code at a time.
32
30
  // ·
33
31
  =end
34
32
 
33
+ #require "uri"
34
+
35
35
  class Users::SessionsController < Devise::SessionsController
36
36
 
37
37
  # Creates a new session for the user and allows them access to the platform
38
38
  def create
39
39
 
40
40
  # search for a existing user
41
- user = Lesli::User.find_for_database_authentication(email: sign_in_params[:email])
41
+ user = ::Lesli::User.find_for_database_authentication(email: sign_in_params[:email])
42
42
 
43
43
  # respond with a no valid credentials generic error if not valid user found
44
44
  unless user
45
- # Lesli::Account::Activity.log("core", "/session/create", "session_creation_failed", "no_valid_email", {
46
- # email: (sign_in_params[:email] || "")
47
- # })
48
- return respond_with_error(I18n.t("core.users/sessions.invalid_credentials"))
45
+ danger(I18n.t("lesli.users/sessions.message_invalid_credentials"))
46
+ redirect_to user_session_path(:r => sign_in_params[:redirect]) and return
49
47
  end
50
48
 
51
49
  # save a invalid credentials log for the requested user
52
- log = user.logs.new({ title: "session_creation_atempt" })
50
+ activity = user.activities.new({ title: "session_create", description:"atempt" })
53
51
 
54
52
  # check password validation
55
53
  unless user.valid_password?(sign_in_params[:password])
56
54
 
57
55
  # save a invalid credentials log for the requested user
58
- log.update({
59
- title: "session_creation_failed",
60
- description: "invalid_credentials"
61
- })
56
+ activity.update(description: "invalid_credentials")
62
57
 
63
58
  # respond with a no valid credentials generic error if not valid user found
64
- return respond_with_error(I18n.t("core.users/sessions.invalid_credentials"))
65
-
59
+ danger(I18n.t("lesli.users/sessions.message_invalid_credentials"))
60
+ redirect_to user_session_path(:r => sign_in_params[:redirect]) and return
66
61
  end
67
62
 
68
63
  # check if user meet requirements to create a new session
@@ -71,16 +66,11 @@ class Users::SessionsController < Devise::SessionsController
71
66
  # if user do not meet requirements to login
72
67
  unless valid
73
68
 
74
- log.update({
75
- title: "session_creation_failed",
76
- description: failures.join(", ")
77
- })
78
-
79
- # return and respond with the reasons user is not able to login
80
- return respond_with_error(failures.join(", "))
69
+ activity.update(description: failures.join(", "))
81
70
 
71
+ danger(failures.join(", "))
72
+ redirect_to user_session_path(:r => sign_in_params[:redirect]) and return
82
73
  end
83
-
84
74
  end
85
75
 
86
76
 
@@ -89,8 +79,9 @@ class Users::SessionsController < Devise::SessionsController
89
79
 
90
80
 
91
81
  # create a new session for the user
92
- current_session = Lesli::UserSessionService.new(user)
82
+ current_session = Lesli::User::SessionService.new(user)
93
83
  .create(get_user_agent(false), request.remote_ip)
84
+ .result
94
85
 
95
86
  # make session id globally available
96
87
  session[:user_session_id] = current_session[:id]
@@ -107,35 +98,34 @@ class Users::SessionsController < Devise::SessionsController
107
98
  # do a user login
108
99
  sign_in(:user, user)
109
100
 
101
+ # create a log for login atempts
102
+ activity.update({
103
+ title: "session_create",
104
+ description: "successful",
105
+ session_id: current_session[:id]
106
+ })
107
+
110
108
  # respond successful and send the path user should go
111
109
  #respond_with_successful({ default_path: user.has_role_with_default_path?() })
112
- respond_with_successful({ default_path: Lesli.config.path_after_login || "/" })
113
-
110
+ #respond_with_successful({ default_path: Lesli.config.path_after_login || "/" })
111
+ redirect_to(safe_redirect_path(sign_in_params[:redirect]))
114
112
  end
115
113
 
116
114
  private
117
115
 
118
- # @return [Parameters] Allowed parameters for the discussion
119
- # @description Sanitizes the parameters received from an HTTP call to only allow the specified ones.
120
- # Allowed params are _:email_, _:password_.
121
- # @example
122
- # supose params contains {
123
- # "user": {
124
- # "id": 5,
125
- # "email": "john.smith@email.com",
126
- # "password": "my_password_123"
127
- # }
128
- # }
129
- # allowed_params = sign_in_params
130
- # puts allowed_params
131
- # will remove the _id_ field and only print {
132
- # "user": {
133
- # "email": "john.smith@email.com",
134
- # "password": "my_password_123"
135
- # }
136
- # }
137
- def sign_in_params
138
- params.fetch(:user, {}).permit(:email, :password)
116
+ def safe_redirect_path redirect_path
117
+ if redirect_path.present?
118
+ uri = URI.parse(redirect_path)
119
+ # Ensures it's a local path
120
+ return redirect_path if uri.relative?
121
+ end
122
+ Lesli.config.path_after_login || root_path
123
+ rescue URI::InvalidURIError
124
+ # If the URL is invalid, fallback to root
125
+ root_path
139
126
  end
140
127
 
128
+ def sign_in_params
129
+ params.fetch(:user, {}).permit(:email, :password, :redirect)
130
+ end
141
131
  end
@@ -0,0 +1,4 @@
1
+ module LesliShield
2
+ module SessionsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliShield
2
+ module SettingsHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module LesliShield
2
+ module UsersHelper
3
+ end
4
+ end
@@ -0,0 +1,64 @@
1
+ module LesliShield
2
+ module AuthenticationInterface
3
+
4
+ # Validate user authentication and session status
5
+ def authenticate_request
6
+
7
+ # this version Lesli requires to be mounted as root "/"
8
+ # engine_path = Lesli::Engine.routes.find_script_name({})
9
+ engine_path = nil
10
+
11
+ # check if the users is logged into the system
12
+ unless user_signed_in?()
13
+
14
+ message = "Please Login to view that page!"
15
+
16
+ # check if requested url is valid
17
+ if (request.get? && is_navigational_format? && !request.xhr? && !request.fullpath.blank?)
18
+
19
+ # redirect only if the path worth it
20
+ if request.fullpath != "/"
21
+
22
+ # redirect with requested url, so user will be redirected after login
23
+ redirect_to("#{engine_path}/login?r=#{request.fullpath}", notice: message) and return
24
+
25
+ end
26
+
27
+ end
28
+
29
+ # redirect to root route
30
+ redirect_to("#{engine_path}/login", notice: message) and return
31
+
32
+ end
33
+
34
+ # run aditinal validations only for html requests
35
+ return true unless request.format.html?
36
+
37
+ # # get the current user session
38
+ # current_session = current_user.sessions.find_by(id: session[:user_session_id])
39
+
40
+ # # check if user has an active session
41
+ # if current_session.equal? nil or !current_session.active?
42
+ # current_user.logs.create({ title: "system_session_logout", description: "session finished by the system"})
43
+ # sign_out current_user
44
+ # redirect_to "#{engine_path}/logout" and return
45
+ # end
46
+
47
+ # if !current_session.expiration_at.blank? && current_session.expiration_at < Time.current
48
+ # current_user.logs.create({ title: "system_session_logout", description: "session expired by the system"})
49
+ # sign_out current_user
50
+ # redirect_to "#{engine_path}/logout" and return
51
+ # end
52
+
53
+ # # check password expiration date
54
+ # if current_user.has_expired_password?
55
+ # unless controller_name == "profiles"
56
+ # current_user.logs.create({ description: "redirect_due_to_expired_password" })
57
+ # redirect_to "/administration/profile#force-password-reset", notice: I18n.t("core.users/sessions.messages_danger_password_expired")
58
+ # return
59
+ # end
60
+ # end
61
+
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,40 @@
1
+ module LesliShield
2
+ module AuthorizationInterface
3
+
4
+ # Check if current_user has privileges to complete this request
5
+ def authorize_request
6
+
7
+ # check if user has access to the requested controller
8
+ # this search is over all the privileges for all the roles of the users
9
+ granted = current_user.has_privileges_for?(params[:controller], params[:action])
10
+
11
+
12
+ # get the path to which the user is limited to
13
+ limited_path = false# current_user.has_role_limited_to_path?
14
+
15
+ # to redirect to the limited path we must check:
16
+ # limited_path must not to be nil or empty string ("")
17
+ # limited_path must not to be equal to the current path (to avoid a loop)
18
+ # request must not to be AJAX
19
+ # request must be for show or index views
20
+ if !limited_path.blank? and
21
+ !(limited_path == request.original_fullpath) and
22
+ !(request[:format] == "json") and
23
+ ["show", "index"].include?(params[:action])
24
+
25
+ return redirect_to(limited_path)
26
+ end
27
+
28
+ # privilege for object not found
29
+ if granted.blank?
30
+ current_user.activities.create({ title: "privilege_not_found", description: request.path })
31
+ return respond_with_unauthorized({ controller: params[:controller], privilege: params[:action] })
32
+ end
33
+
34
+ unless granted
35
+ current_user.activities.create({ title: "privilege_not_granted", description: request.path })
36
+ return respond_with_unauthorized({ controller: params[:controller], privilege: params[:action] })
37
+ end
38
+ end
39
+ end
40
+ end
@@ -30,24 +30,14 @@ Building a better future, one line of code at a time.
30
30
  // ·
31
31
  =end
32
32
 
33
- class CreateLesliShieldDashboardComponents < ActiveRecord::Migration[6.1]
34
- def change
35
- gem_path = Lesli::System.engine("Lesli", "dir")
36
- table_base_structure = JSON.parse(File.read(File.join(gem_path, "db", "structure", "00000502_dashboard_components.json")))
37
- create_table :lesli_shield_dashboard_components do |t|
38
- table_base_structure.each do |column|
39
- t.send(
40
- column["type"].parameterize.underscore.to_sym,
41
- column["name"].parameterize.underscore.to_sym
42
- )
43
- end
44
- t.timestamps
45
- end
33
+ module LesliShield
34
+ class Account < ApplicationRecord
35
+ belongs_to :account, class_name: "Lesli::Account"
36
+
37
+ after_create :initialize_account
46
38
 
47
- add_reference(
48
- :lesli_shield_dashboard_components, :dashboard,
49
- foreign_key: { to_table: :lesli_shield_dashboards },
50
- index: { name: "lesli_shield_dashboard_components_index" }
51
- )
39
+ def initialize_account
40
+ #Dashboard.initialize_dashboard(self)
41
+ end
52
42
  end
53
43
  end
@@ -1,5 +1,5 @@
1
1
  module LesliShield
2
- class ApplicationRecord < ActiveRecord::Base
3
- self.abstract_class = true
4
- end
2
+ class ApplicationRecord < ::Lesli::ApplicationLesliRecord
3
+ self.abstract_class = true
4
+ end
5
5
  end
@@ -0,0 +1,4 @@
1
+ module LesliShield
2
+ class Setting < ApplicationRecord
3
+ end
4
+ end
@@ -0,0 +1,5 @@
1
+ module LesliShield
2
+ class User < ::Lesli::User
3
+ #has_many :activities, class_name: "Lesli::Item::Activity"
4
+ end
5
+ end
@@ -0,0 +1,39 @@
1
+ =begin
2
+
3
+ Lesli
4
+
5
+ Copyright (c) 2025, 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 LesliTech
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
+ module LesliShield
34
+ class Tokens < ApplicationLesliService
35
+ def self.friendly_token(length:40)
36
+ Devise.friendly_token(length)
37
+ end
38
+ end
39
+ end
@@ -1,2 +1,16 @@
1
1
  <h2>Resend confirmation instructions</h2>
2
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" %>
@@ -1,79 +1,37 @@
1
- <%
2
- =begin
3
1
 
4
- Lesli
2
+ <%= render("lesli/wrappers/application-devise-simple", title:"Cambiar contraseña") do %>
5
3
 
6
- Copyright (c) 2023, Lesli Technologies, S. A.
4
+ <%= form_for(
5
+ resource,
6
+ as: resource_name,
7
+ url: user_password_path(reset_password_token: params[:reset_password_token]),
8
+ html: { class: "has-text-centered", method: :put },
9
+ builder: LesliView::Forms::Builder
10
+ ) do |form| %>
7
11
 
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
+ <%= render "devise/shared/error_messages", resource: resource %>
12
13
 
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.
14
+ <%= form.field_control_builder(
15
+ label_html:form.label(:password),
16
+ control_html:form.password_field(:password, autocomplete: "current-password", placeholder: "* * * * * *"),
17
+ message_text: flash.first&.second,
18
+ category: flash.first&.first,
19
+ icon: "key"
20
+ ) %>
17
21
 
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/.
22
+ <%= form.field_control_builder(
23
+ label_html:form.label(:password_confirmation),
24
+ control_html:form.password_field(:password_confirmation, autocomplete: "current-password", placeholder: "* * * * * *"),
25
+ message_text: flash.first&.second,
26
+ category: flash.first&.first,
27
+ icon: "key"
28
+ ) %>
20
29
 
21
- Lesli · Ruby on Rails SaaS Development Framework.
30
+ <input type="hidden" name="user[reset_password_token]" value="<%= params[:reset_password_token] %>">
22
31
 
23
- Made with by https://www.lesli.tech
24
- Building a better future, one line of code at a time.
32
+ <%= form.field_control_button("Cambiar contraseña", icon:"key") %>
25
33
 
26
- @contact hello@lesli.tech
27
- @website https://www.lesli.tech
28
- @license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
34
+ <% end %>
29
35
 
30
- // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
- // ·
32
- =end
33
- %>
34
-
35
- <%= render("lesli/wrappers/application-devise-simple", title: "Cambiar contraseña") do %>
36
-
37
- <form ref="form" @submit="putPasswordEdit">
38
- <p v-if="notification.show" :class="[notification.type, 'is-size-5', 'mt-2']">
39
- {{ notification.message }}
40
- </p>
41
- <div class="field mb-4">
42
- <p class="label mb-2">Ingrese su nueva contraseña</p>
43
- <p class="control has-icons-left">
44
- <input
45
- class="input"
46
- type="password"
47
- v-model="password_edit.new_password"
48
- required="true"
49
- name="user_email"
50
- placeholder="Contraseña nueva"
51
- />
52
- <span class="icon is-small is-left">
53
- <i class="ri-key-line"></i>
54
- </span>
55
- </p>
56
- </div>
57
- <div class="field mb-4">
58
- <p class="label mb-1">Confirmar contraseña</p>
59
- <p class="control has-icons-left">
60
- <input
61
- class="input"
62
- type="password"
63
- v-model="password_edit.new_password_confirmation"
64
- required="true"
65
- name="user_email"
66
- placeholder="Confirmar contraseña"
67
- />
68
- <span class="icon is-small is-left">
69
- <i class="ri-key-2-line"></i>
70
- </span>
71
- </p>
72
- </div>
73
- <div class="login-controls has-text-centered">
74
- <button class="button is-primary">
75
- Cambiar contraseña
76
- </button>
77
- </div>
78
- </form>
36
+ <%= render("devise/shared/links", login:true, password_reset:false, magic_link:false, otp:false) %>
79
37
  <% end %>
@@ -1,75 +1,33 @@
1
- <%
2
- =begin
3
1
 
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
-
36
- <%= render("lesli/wrappers/application-devise-simple", title: "Forgot your password?") do %>
37
-
38
- <form class="has-text-centered" @submit="postPasswordNew" method="post">
39
-
40
- <div class="field mb-4">
41
- <p class="label mb-2">
42
- Enter your email address you use in Lesli.
43
- We'll send instructions for setting a new password to your email.
44
- </p>
45
- <p v-if="notification.show" :class="['help', notification.type, 'is-size-5', 'mt-2']">
46
- {{ notification.message }}
47
- </p>
48
- <div class="control has-icons-left has-icons-right">
49
- <input
50
- class="input"
51
- type="email"
52
- v-model="sign_in.email"
53
- required="true"
54
- name="user_email"
55
- placeholder="email"
56
- />
57
- <span :class="['icon', 'is-small', 'is-left', `has-text-${notification.type}`]">
58
- <i class="ri-mail-lock-line"></i>
59
- </span>
60
- </div>
61
- </div>
62
-
63
- <div class="field">
64
- <div class="control">
65
- <button
66
- type="submit"
67
- :class="['button', 'is-primary', 'mb-2', {'is-loading':loading}]">
68
- Send password reset instructions
69
- </button>
70
- </div>
71
- </div>
72
- </form>
73
-
74
- <%= render("devise/shared/links", magic_link:false, otp:false, login:true) %>
2
+ <%= render("lesli/wrappers/application-devise-simple", title:"Forgot your password?") do %>
3
+
4
+ <%= form_for(
5
+ resource,
6
+ as: resource_name,
7
+ url: user_password_path(),
8
+ html: { class: "has-text-centered" },
9
+ builder: LesliView::Forms::Builder
10
+ ) do |form| %>
11
+
12
+ <%= render "devise/shared/error_messages", resource: resource %>
13
+
14
+ <%= form.field_control_email(
15
+ :email,
16
+ icon: "person_search",
17
+ label: "Enter your email address you use in Lesli. We'll send instructions for setting a new password to your email.")
18
+ %>
19
+
20
+ <%= form.field_control_button("Send me reset password instructions", icon:"email") %>
21
+
22
+ <% if Lesli.config.security.dig(:allow_registration) %>
23
+ <p class="account has-text-centered">
24
+ Still not registered?
25
+ <%= link_to(new_user_registration_path, :class => "has-text-primary") do %>
26
+ <u><b>Create account</b></u>
27
+ <% end %>
28
+ </p>
29
+ <% end %>
30
+ <% end %>
31
+
32
+ <%= render("devise/shared/links", login:true, password_reset:false, magic_link:false, otp:false) %>
75
33
  <% end %>