lesli 5.0.11 → 5.0.12
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 +4 -4
- data/app/assets/config/lesli_manifest.js +0 -13
- data/app/assets/icons/lesli/engine-security.svg +1 -0
- data/app/assets/icons/lesli/engine-shield.svg +1 -0
- data/app/assets/images/lesli/lesli-logo.svg +4 -0
- data/app/assets/stylesheets/lesli/templates/application.css +21862 -209
- data/app/assets/stylesheets/lesli/templates/public.css +19098 -1
- data/app/assets/stylesheets/lesli/users/confirmations.css +19219 -0
- data/app/assets/stylesheets/lesli/users/passwords.css +19202 -0
- data/app/assets/stylesheets/lesli/users/registrations.css +19594 -0
- data/app/assets/stylesheets/lesli/users/sessions.css +19594 -1
- data/app/controllers/lesli/abouts_controller.rb +12 -18
- data/app/controllers/lesli/application_controller.rb +25 -25
- data/app/controllers/lesli/application_lesli_controller.rb +5 -6
- data/app/controllers/lesli/interfaces/application/authorization.rb +1 -1
- data/app/controllers/lesli/interfaces/application/customization.rb +1 -1
- data/app/controllers/lesli/interfaces/application/requester.rb +2 -2
- data/app/controllers/lesli/interfaces/application/responder.rb +8 -8
- data/app/controllers/lesli/interfaces/controllers/actions.rb +250 -0
- data/app/controllers/lesli/interfaces/controllers/activities.rb +215 -0
- data/app/controllers/lesli/interfaces/controllers/discussions.rb +270 -0
- data/app/controllers/lesli/interfaces/controllers/files.rb +467 -0
- data/app/controllers/lesli/interfaces/controllers/subscribers.rb +234 -0
- data/app/helpers/lesli/assets_helper.rb +4 -4
- data/app/helpers/lesli/navigation_helper.rb +38 -81
- data/app/lib/lesli/system.rb +4 -3
- data/app/models/concerns/account_initializer.rb +46 -42
- data/{lib/scss/devise/registrations.scss → app/models/lesli/account/detail.rb} +7 -3
- data/app/models/lesli/account.rb +12 -5
- data/app/models/lesli/cloud_object/action.rb +70 -0
- data/app/models/lesli/cloud_object/activity.rb +311 -0
- data/app/models/lesli/cloud_object/custom_field.rb +158 -0
- data/app/models/lesli/cloud_object/discussion.rb +219 -0
- data/app/models/lesli/cloud_object/subscriber.rb +186 -0
- data/app/models/lesli/shared/dashboard.rb +16 -5
- data/app/models/lesli/user/session.rb +0 -2
- data/app/models/lesli/user.rb +13 -13
- data/app/operators/lesli/user_registration_operator.rb +3 -3
- data/app/views/lesli/layouts/application-devise.html.erb +6 -6
- data/app/views/lesli/layouts/application-lesli.html.erb +1 -1
- data/app/views/lesli/partials/_application-data.html.erb +2 -1
- data/app/views/lesli/partials/_application-lesli-engines.html.erb +14 -39
- data/app/views/lesli/partials/_application-lesli-header.html.erb +4 -4
- data/app/views/lesli/partials/_application-lesli-icons.html.erb +1 -1
- data/app/views/lesli/partials/_application-lesli-panels.html.erb +7 -7
- data/app/views/lesli/wrappers/_application-devise.html.erb +5 -7
- data/config/initializers/devise.rb +335 -335
- data/config/initializers/lesli.rb +2 -1
- data/config/locales/translations.en.yml +4 -0
- data/config/locales/translations.es.yml +4 -0
- data/config/locales/translations.fr.yml +28 -0
- data/config/locales/translations.it.yml +28 -0
- data/config/locales/translations.pt.yml +28 -0
- data/config/routes.rb +1 -10
- data/db/migrate/{v1.0/0010003010_create_lesli_user_details.rb → v1/0010000110_create_lesli_accounts.rb} +19 -13
- data/db/migrate/{v1.0/0010000110_create_lesli_accounts.rb → v1/0010001010_create_lesli_account_details.rb} +5 -7
- data/db/migrate/{v1.0/0010001010_create_lesli_account_settings.rb → v1/0010001110_create_lesli_account_settings.rb} +2 -2
- data/db/seed/development/accounts.rb +10 -7
- data/db/seed/development/users.rb +20 -20
- data/db/seed/production/accounts.rb +10 -7
- data/lib/lesli/engine.rb +2 -12
- data/lib/lesli/version.rb +2 -2
- data/lib/lesli.rb +0 -1
- data/lib/scss/cloud-objects/discussion.scss +8 -5
- data/lib/scss/layouts/application-header.scss +3 -1
- data/lib/scss/layouts/application-navbar.scss +2 -1
- data/lib/scss/{elements/msg.scss → overrides/notification.scss} +16 -18
- data/lib/scss/pages/devise-simple.scss +4 -2
- data/lib/scss/pages/devise.scss +111 -107
- data/lib/scss/panels/panel-notification.scss +1 -1
- data/lib/scss/panels/{panel-ticket.scss → panel-support-ticket.scss} +3 -4
- data/lib/scss/templates/application.scss +7 -5
- data/lib/tasks/lesli/controllers.rake +1 -1
- data/lib/tasks/lesli/db.rake +24 -12
- data/lib/tasks/lesli_tasks.rake +6 -6
- data/lib/vue/application.js +13 -12
- data/lib/vue/{refactor/shared/cloudobjects → cloudobjects}/discussion/content.vue +10 -8
- data/lib/vue/cloudobjects/discussion/element.vue +170 -0
- data/lib/vue/{refactor/shared/cloudobjects → cloudobjects}/discussion/filters.vue +1 -1
- data/lib/vue/{refactor/shared/cloudobjects → cloudobjects}/discussion/new.vue +20 -16
- data/lib/vue/{refactor/shared/cloudobjects → cloudobjects}/discussion.vue +25 -24
- data/lib/vue/{refactor/stores/cloudobjects → cloudobjects/stores}/discussion.js +7 -16
- data/lib/vue/layouts/application-header.vue +5 -5
- data/lib/vue/panels/{panel-notifications.vue → panel-bell-notifications.vue} +15 -19
- data/lib/vue/panels/panel-support-tickets.vue +161 -0
- data/lib/vue/panels/stores/bell-notifications.js +46 -0
- data/lib/vue/panels/stores/support-tickets.js +103 -0
- data/lib/vue/shared/dashboards/apps/edit.vue +10 -10
- data/lib/vue/shared/dashboards/components/form.vue +31 -40
- data/lib/vue/shared/stores/dashboard.js +2 -0
- data/lib/vue/shared/stores/layout.js +2 -1
- data/lib/{scss/devise/confirmations.scss → vue/shared/stores/users.js} +22 -21
- data/lib/vue/stores/translations.json +109 -2
- data/lib/webpack/base.js +9 -8
- data/lib/webpack/core.js +8 -6
- data/readme.md +16 -15
- metadata +49 -76
- data/app/assets/icons/lesli/engine-guard.svg +0 -1
- data/app/assets/javascripts/lesli/users/sessions.js +0 -1
- data/app/controllers/users/confirmations_controller.rb +0 -66
- data/app/controllers/users/omniauth_callbacks_controller.rb +0 -30
- data/app/controllers/users/passwords_controller.rb +0 -71
- data/app/controllers/users/registrations_controller.rb +0 -141
- data/app/controllers/users/sessions_controller.rb +0 -141
- data/app/controllers/users/unlocks_controller.rb +0 -30
- data/app/views/devise/confirmations/new.html.erb +0 -2
- data/app/views/devise/confirmations/show.html.erb +0 -63
- data/app/views/devise/mailer/confirmation_instructions.html.erb +0 -5
- data/app/views/devise/mailer/email_changed.html.erb +0 -7
- data/app/views/devise/mailer/password_change.html.erb +0 -3
- data/app/views/devise/mailer/reset_password_instructions.html.erb +0 -8
- data/app/views/devise/mailer/unlock_instructions.html.erb +0 -7
- data/app/views/devise/passwords/edit.html.erb +0 -79
- data/app/views/devise/passwords/new.html.erb +0 -75
- data/app/views/devise/registrations/edit.html.erb +0 -43
- data/app/views/devise/registrations/new.html.erb +0 -147
- data/app/views/devise/sessions/new.html.erb +0 -114
- data/app/views/devise/shared/_demo.html.erb +0 -7
- data/app/views/devise/shared/_error_messages.html.erb +0 -15
- data/app/views/devise/shared/_links.html.erb +0 -96
- data/app/views/devise/unlocks/new.html.erb +0 -16
- data/db/migrate/v1.0/0010000210_create_lesli_roles.rb +0 -59
- data/db/migrate/v1.0/0010000310_create_lesli_users.rb +0 -97
- data/db/migrate/v1.0/0010003110_create_lesli_user_settings.rb +0 -44
- data/db/migrate/v1.0/0010003210_create_lesli_user_sessions.rb +0 -55
- data/db/migrate/v1.0/0010003410_create_lesli_user_powers.rb +0 -43
- data/db/migrate/v1.0/0010004010_create_lesli_user_logs.rb +0 -45
- data/db/migrate/v1.0/0010005010_create_lesli_descriptors.rb +0 -44
- data/db/migrate/v1.0/0010005110_create_lesli_descriptor_privileges.rb +0 -45
- data/db/migrate/v1.0/0010005210_create_lesli_descriptor_activities.rb +0 -49
- data/db/migrate/v1.0/0010005510_create_lesli_role_powers.rb +0 -51
- data/db/migrate/v1.0/0010005710_create_lesli_role_privileges.rb +0 -45
- data/lib/lesli/routing.rb +0 -26
- data/lib/scss/components/editor-richtext.scss +0 -88
- data/lib/scss/devise/oauth.scss +0 -34
- data/lib/scss/devise/passwords.scss +0 -33
- data/lib/scss/devise/sessions.scss +0 -35
- data/lib/scss/elements/avatar.scss +0 -48
- data/lib/scss/elements/calendar.scss +0 -47
- data/lib/scss/elements/toggle.scss +0 -102
- data/lib/vue/devise/confirmations.js +0 -33
- data/lib/vue/devise/passwords.js +0 -137
- data/lib/vue/devise/registrations.js +0 -157
- data/lib/vue/devise/sessions.js +0 -148
- data/lib/vue/panels/panel-tickets.vue +0 -181
- data/lib/vue/refactor/shared/cloudobjects/discussion/element.vue +0 -132
- data/lib/vue/shared/stores/account.js +0 -113
- /data/app/assets/icons/lesli/{engine-driver.svg → engine-calendar.svg} +0 -0
- /data/db/migrate/{v1.0 → v1}/0010000610_create_lesli_system_controllers.rb +0 -0
- /data/db/migrate/{v1.0 → v1}/0010000710_create_lesli_system_controller_actions.rb +0 -0
- /data/db/migrate/{v1.0 → v1}/0010001210_create_lesli_account_activities.rb +0 -0
- /data/db/migrate/{v1.0 → v1}/0010001410_create_lesli_account_logs.rb +0 -0
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|
4
|
-
# You should configure your model like this:
|
|
5
|
-
# devise :omniauthable, omniauth_providers: [:twitter]
|
|
6
|
-
|
|
7
|
-
# You should also create an action method in this controller like this:
|
|
8
|
-
# def twitter
|
|
9
|
-
# end
|
|
10
|
-
|
|
11
|
-
# More info at:
|
|
12
|
-
# https://github.com/heartcombo/devise#omniauth
|
|
13
|
-
|
|
14
|
-
# GET|POST /resource/auth/twitter
|
|
15
|
-
# def passthru
|
|
16
|
-
# super
|
|
17
|
-
# end
|
|
18
|
-
|
|
19
|
-
# GET|POST /users/auth/twitter/callback
|
|
20
|
-
# def failure
|
|
21
|
-
# super
|
|
22
|
-
# end
|
|
23
|
-
|
|
24
|
-
# protected
|
|
25
|
-
|
|
26
|
-
# The path used when OmniAuth fails
|
|
27
|
-
# def after_omniauth_failure_path_for(scope)
|
|
28
|
-
# super(scope)
|
|
29
|
-
# end
|
|
30
|
-
end
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class Users::PasswordsController < Devise::PasswordsController
|
|
4
|
-
|
|
5
|
-
# Sends an email with a token, so the user can reset their password
|
|
6
|
-
def create
|
|
7
|
-
|
|
8
|
-
if params[:user].blank?
|
|
9
|
-
#Account::Activity.log("core", "/password/create", "password_creation_failed", "no_valid_email")
|
|
10
|
-
return respond_with_error(I18n.t("core.shared.messages_warning_user_not_found"))
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
if params[:user][:email].blank?
|
|
14
|
-
#Account::Activity.log("core", "/password/create", "password_creation_failed", "no_valid_email")
|
|
15
|
-
return respond_with_error(I18n.t("core.shared.messages_warning_user_not_found"))
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
user = Lesli::User.find_by(:email => params[:user][:email])
|
|
19
|
-
|
|
20
|
-
if user.blank?
|
|
21
|
-
# Account::Activity.log("core", "/password/create", "password_creation_failed", "no_valid_email", {
|
|
22
|
-
# email: (params[:user][:email] || "")
|
|
23
|
-
# })
|
|
24
|
-
return respond_with_error(I18n.t("core.shared.messages_warning_user_not_found"))
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
unless user.active
|
|
28
|
-
# user.logs.create({title: "password_creation_failed", description: "user_not_active"})
|
|
29
|
-
# Account::Activity.log("core", "/password/create", "password_creation_failed", "user_not_active")
|
|
30
|
-
return respond_with_error(I18n.t("core.users/passwords.messages_danger_inactive_user"))
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
token = user.generate_password_reset_token
|
|
34
|
-
|
|
35
|
-
#user.logs.create({ title: "password_creation_successful" })
|
|
36
|
-
|
|
37
|
-
begin
|
|
38
|
-
Lesli::DeviseMailer.reset_password_instructions(user, token).deliver_now
|
|
39
|
-
respond_with_successful
|
|
40
|
-
rescue => exception
|
|
41
|
-
#Honeybadger.notify(exception)
|
|
42
|
-
respond_with_error(exception.message)
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
def update
|
|
47
|
-
super do |resource|
|
|
48
|
-
|
|
49
|
-
# check if password update was ok
|
|
50
|
-
if resource.errors.empty?
|
|
51
|
-
|
|
52
|
-
# reset password expiration due the user just updated his password
|
|
53
|
-
if resource.has_expired_password?
|
|
54
|
-
resource.update(password_expiration_at: nil)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
resource.logs.create(title: "password_reset_successful")
|
|
58
|
-
|
|
59
|
-
return respond_with_successful
|
|
60
|
-
|
|
61
|
-
else
|
|
62
|
-
|
|
63
|
-
resource.logs.create(title: "password_reset_error") if resource.id
|
|
64
|
-
|
|
65
|
-
return respond_with_error(resource.errors.full_messages.to_sentence)
|
|
66
|
-
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
end
|
|
70
|
-
end
|
|
71
|
-
end
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
Lesli
|
|
6
|
-
|
|
7
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
8
|
-
|
|
9
|
-
This program is free software: you can redistribute it and/or modify
|
|
10
|
-
it under the terms of the GNU General Public License as published by
|
|
11
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
-
(at your option) any later version.
|
|
13
|
-
|
|
14
|
-
This program is distributed in the hope that it will be useful,
|
|
15
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
GNU General Public License for more details.
|
|
18
|
-
|
|
19
|
-
You should have received a copy of the GNU General Public License
|
|
20
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
-
|
|
22
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
23
|
-
|
|
24
|
-
Made with ♥ by https://www.lesli.tech
|
|
25
|
-
Building a better future, one line of code at a time.
|
|
26
|
-
|
|
27
|
-
@contact hello@lesli.tech
|
|
28
|
-
@website https://www.lesli.tech
|
|
29
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
30
|
-
|
|
31
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
32
|
-
// ·
|
|
33
|
-
=end
|
|
34
|
-
|
|
35
|
-
class Users::RegistrationsController < Devise::RegistrationsController
|
|
36
|
-
before_action :configure_sign_up_params, only: [:create]
|
|
37
|
-
# before_action :configure_account_update_params, only: [:update]
|
|
38
|
-
|
|
39
|
-
# GET /resource/sign_up
|
|
40
|
-
# def new
|
|
41
|
-
# super
|
|
42
|
-
# end
|
|
43
|
-
|
|
44
|
-
def create
|
|
45
|
-
|
|
46
|
-
# # Check if instance allow multi-account
|
|
47
|
-
# if !Rails.application.config.lesli.dig(:security, :allow_registration)
|
|
48
|
-
# respond_with_error(I18n.t("core.users/registrations.messages_error_registration_not_allowed"))
|
|
49
|
-
# return
|
|
50
|
-
# end
|
|
51
|
-
|
|
52
|
-
# # Validate user is unique
|
|
53
|
-
# if ::User.with_deleted.find_by(email: sign_up_params["email"])
|
|
54
|
-
# return respond_with_error(I18n.t("core.users/registrations.messages_info_user_already_exists"))
|
|
55
|
-
# end
|
|
56
|
-
|
|
57
|
-
# build new user
|
|
58
|
-
user = build_resource(sign_up_params)
|
|
59
|
-
|
|
60
|
-
# run password complexity validations
|
|
61
|
-
#user_validator = UsersValidator.new(user).password_complexity(sign_up_params[:password])
|
|
62
|
-
|
|
63
|
-
# return if there are errors with the complexity validations
|
|
64
|
-
# unless user_validator.valid?
|
|
65
|
-
# return respond_with_error("password_complexity_error", password_complexity.failures)
|
|
66
|
-
# end
|
|
67
|
-
|
|
68
|
-
# persist new user
|
|
69
|
-
if user.save
|
|
70
|
-
respond_with_successful()
|
|
71
|
-
else
|
|
72
|
-
respond_with_error(user.errors.full_messages.to_sentence)
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# GET /resource/edit
|
|
77
|
-
# def edit
|
|
78
|
-
# super
|
|
79
|
-
# end
|
|
80
|
-
|
|
81
|
-
# PUT /resource
|
|
82
|
-
# def update
|
|
83
|
-
# super
|
|
84
|
-
# end
|
|
85
|
-
|
|
86
|
-
# DELETE /resource
|
|
87
|
-
# def destroy
|
|
88
|
-
# super
|
|
89
|
-
# end
|
|
90
|
-
|
|
91
|
-
# GET /resource/cancel
|
|
92
|
-
# Forces the session data which is usually expired after sign
|
|
93
|
-
# in to be expired now. This is useful if the user wants to
|
|
94
|
-
# cancel oauth signing in/up in the middle of the process,
|
|
95
|
-
# removing all OAuth session data.
|
|
96
|
-
# def cancel
|
|
97
|
-
# super
|
|
98
|
-
# end
|
|
99
|
-
|
|
100
|
-
protected
|
|
101
|
-
|
|
102
|
-
# If you have extra params to permit, append them to the sanitizer.
|
|
103
|
-
# def configure_account_update_params
|
|
104
|
-
# devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])
|
|
105
|
-
# end
|
|
106
|
-
|
|
107
|
-
# If you have extra params to permit, append them to the sanitizer.
|
|
108
|
-
def configure_sign_up_params
|
|
109
|
-
devise_parameter_sanitizer.permit(:sign_up, keys: [
|
|
110
|
-
:email,
|
|
111
|
-
:password,
|
|
112
|
-
:password_confirmation
|
|
113
|
-
])
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
# The path used after sign up.
|
|
117
|
-
# def after_sign_up_path_for(resource)
|
|
118
|
-
# super(resource)
|
|
119
|
-
# end
|
|
120
|
-
|
|
121
|
-
# The path used after sign up for inactive accounts.
|
|
122
|
-
# def after_inactive_sign_up_path_for(resource)
|
|
123
|
-
# super(resource)
|
|
124
|
-
# end
|
|
125
|
-
|
|
126
|
-
# def sign_up_params
|
|
127
|
-
# params.permit(:sign_up, keys: [
|
|
128
|
-
# :email,
|
|
129
|
-
# :password,
|
|
130
|
-
# :password_confirmation
|
|
131
|
-
# ])
|
|
132
|
-
# end
|
|
133
|
-
|
|
134
|
-
def sign_up_params
|
|
135
|
-
params.permit(:sign_up,
|
|
136
|
-
:email,
|
|
137
|
-
:password,
|
|
138
|
-
:password_confirmation
|
|
139
|
-
)
|
|
140
|
-
end
|
|
141
|
-
end
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
=begin
|
|
4
|
-
|
|
5
|
-
Lesli
|
|
6
|
-
|
|
7
|
-
Copyright (c) 2023, Lesli Technologies, S. A.
|
|
8
|
-
|
|
9
|
-
This program is free software: you can redistribute it and/or modify
|
|
10
|
-
it under the terms of the GNU General Public License as published by
|
|
11
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
12
|
-
(at your option) any later version.
|
|
13
|
-
|
|
14
|
-
This program is distributed in the hope that it will be useful,
|
|
15
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
16
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
17
|
-
GNU General Public License for more details.
|
|
18
|
-
|
|
19
|
-
You should have received a copy of the GNU General Public License
|
|
20
|
-
along with this program. If not, see http://www.gnu.org/licenses/.
|
|
21
|
-
|
|
22
|
-
Lesli · Ruby on Rails SaaS Development Framework.
|
|
23
|
-
|
|
24
|
-
Made with ♥ by https://www.lesli.tech
|
|
25
|
-
Building a better future, one line of code at a time.
|
|
26
|
-
|
|
27
|
-
@contact hello@lesli.tech
|
|
28
|
-
@website https://www.lesli.tech
|
|
29
|
-
@license GPLv3 http://www.gnu.org/licenses/gpl-3.0.en.html
|
|
30
|
-
|
|
31
|
-
// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
|
|
32
|
-
// ·
|
|
33
|
-
=end
|
|
34
|
-
|
|
35
|
-
class Users::SessionsController < Devise::SessionsController
|
|
36
|
-
|
|
37
|
-
# Creates a new session for the user and allows them access to the platform
|
|
38
|
-
def create
|
|
39
|
-
|
|
40
|
-
# search for a existing user
|
|
41
|
-
user = Lesli::User.find_for_database_authentication(email: sign_in_params[:email])
|
|
42
|
-
|
|
43
|
-
# respond with a no valid credentials generic error if not valid user found
|
|
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"))
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
# save a invalid credentials log for the requested user
|
|
52
|
-
log = user.logs.new({ title: "session_creation_atempt" })
|
|
53
|
-
|
|
54
|
-
# check password validation
|
|
55
|
-
unless user.valid_password?(sign_in_params[:password])
|
|
56
|
-
|
|
57
|
-
# save a invalid credentials log for the requested user
|
|
58
|
-
log.update({
|
|
59
|
-
title: "session_creation_failed",
|
|
60
|
-
description: "invalid_credentials"
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
# 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
|
-
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
# check if user meet requirements to create a new session
|
|
69
|
-
Lesli::UsersValidator.new(user).valid? do |valid, failures|
|
|
70
|
-
|
|
71
|
-
# if user do not meet requirements to login
|
|
72
|
-
unless valid
|
|
73
|
-
|
|
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(", "))
|
|
81
|
-
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
# remember the user (not enabled by default)
|
|
88
|
-
# remember_me(user) if sign_in_params[:remember_me] == '1'
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
# create a new session for the user
|
|
92
|
-
current_session = Lesli::UserSessionService.new(user)
|
|
93
|
-
.create(get_user_agent(false), request.remote_ip)
|
|
94
|
-
|
|
95
|
-
# make session id globally available
|
|
96
|
-
session[:user_session_id] = current_session[:id]
|
|
97
|
-
|
|
98
|
-
# create a new multi factor authentication service instance for the current user
|
|
99
|
-
#mfa_service = User::MfaService.new(user, log)
|
|
100
|
-
|
|
101
|
-
# generate a new mfa for the current session (if enabled)
|
|
102
|
-
#mfa_service.generate do |success|
|
|
103
|
-
# mfa was successfully generated, return the user to the mfa page
|
|
104
|
-
# return respond_with_successful({ default_path: "mfa" }) if success
|
|
105
|
-
#end
|
|
106
|
-
|
|
107
|
-
# do a user login
|
|
108
|
-
sign_in(:user, user)
|
|
109
|
-
|
|
110
|
-
# respond successful and send the path user should go
|
|
111
|
-
#respond_with_successful({ default_path: user.has_role_with_default_path?() })
|
|
112
|
-
respond_with_successful({ default_path: Lesli.config.path_after_login || "/" })
|
|
113
|
-
|
|
114
|
-
end
|
|
115
|
-
|
|
116
|
-
private
|
|
117
|
-
|
|
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)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
end
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
class Users::UnlocksController < Devise::UnlocksController
|
|
4
|
-
# GET /resource/unlock/new
|
|
5
|
-
# def new
|
|
6
|
-
# super
|
|
7
|
-
# end
|
|
8
|
-
|
|
9
|
-
# POST /resource/unlock
|
|
10
|
-
# def create
|
|
11
|
-
# super
|
|
12
|
-
# end
|
|
13
|
-
|
|
14
|
-
# GET /resource/unlock?unlock_token=abcdef
|
|
15
|
-
# def show
|
|
16
|
-
# super
|
|
17
|
-
# end
|
|
18
|
-
|
|
19
|
-
# protected
|
|
20
|
-
|
|
21
|
-
# The path used after sending unlock password instructions
|
|
22
|
-
# def after_sending_unlock_instructions_path_for(resource)
|
|
23
|
-
# super(resource)
|
|
24
|
-
# end
|
|
25
|
-
|
|
26
|
-
# The path used after unlocking the resource
|
|
27
|
-
# def after_unlock_path_for(resource)
|
|
28
|
-
# super(resource)
|
|
29
|
-
# end
|
|
30
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
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
|
-
<% content_for :application_custom_assets do %>
|
|
36
|
-
<script>
|
|
37
|
-
//setTimeout(() => { window.location.href = "/"; }, 10000)
|
|
38
|
-
</script>
|
|
39
|
-
<% end %>
|
|
40
|
-
|
|
41
|
-
<%= render("lesli/wrappers/application-devise-simple", title: "Account confirmation") do %>
|
|
42
|
-
|
|
43
|
-
<% if flash[:danger] %>
|
|
44
|
-
<% flash.each do |type, msg| %>
|
|
45
|
-
<div class="notification is-<%= type %>">
|
|
46
|
-
<%= msg %>
|
|
47
|
-
</div>
|
|
48
|
-
<% end %>
|
|
49
|
-
<% end %>
|
|
50
|
-
|
|
51
|
-
<% if flash[:success] %>
|
|
52
|
-
<div class="confirmation-message">
|
|
53
|
-
<svg version="1.1" viewBox="0 0 512 512" width="512px" xml:space="preserve" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
54
|
-
<path d="M256,6.998c-137.533,0-249,111.467-249,249c0,137.534,111.467,249,249,249s249-111.467,249-249 C505,118.464,393.533,6.998,256,6.998z M256,485.078c-126.309,0-229.08-102.771-229.08-229.081 c0-126.31,102.771-229.08,229.08-229.08c126.31,0,229.08,102.771,229.08,229.08C485.08,382.307,382.31,485.078,256,485.078z"/>
|
|
55
|
-
<polygon points="384.235,158.192 216.919,325.518 127.862,236.481 113.72,250.624 216.919,353.803 398.28,172.334"/>
|
|
56
|
-
</svg>
|
|
57
|
-
<p>Confirmation successfully</p>
|
|
58
|
-
</div>
|
|
59
|
-
<% end %>
|
|
60
|
-
|
|
61
|
-
<% end %>
|
|
62
|
-
|
|
63
|
-
|
|
@@ -1,7 +0,0 @@
|
|
|
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 %>
|
|
@@ -1,8 +0,0 @@
|
|
|
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>
|
|
@@ -1,7 +0,0 @@
|
|
|
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>
|
|
@@ -1,79 +0,0 @@
|
|
|
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
|
-
<%= 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>
|
|
79
|
-
<% end %>
|
|
@@ -1,75 +0,0 @@
|
|
|
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
|
-
|
|
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:true, otp:true, login:true) %>
|
|
75
|
-
<% end %>
|