lesli 5.0.11 → 5.0.13
Sign up to get free protection for your applications and to get access to all the features.
- 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/brand/app-logo.png +0 -0
- data/app/assets/images/lesli/lesli-logo.svg +4 -0
- data/app/assets/javascripts/lesli/templates/application.js +14 -0
- data/app/assets/javascripts/lesli/templates/public.js +14 -0
- data/app/assets/stylesheets/lesli/templates/application.css +1365 -293
- data/app/assets/stylesheets/lesli/templates/public.css +1 -1
- data/app/controllers/lesli/abouts_controller.rb +12 -18
- data/app/controllers/lesli/application_controller.rb +26 -25
- data/app/controllers/lesli/application_lesli_controller.rb +5 -6
- data/app/controllers/lesli/interfaces/application/authorization.rb +2 -2
- 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 +26 -8
- data/app/helpers/lesli/navigation_helper.rb +53 -92
- data/app/lib/date2.rb +8 -0
- data/app/lib/lesli/system.rb +17 -4
- data/app/models/concerns/account_initializer.rb +46 -42
- data/app/models/concerns/user_extensions.rb +6 -0
- 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/controller_operator.rb +4 -1
- data/app/operators/lesli/user_registration_operator.rb +3 -3
- data/app/services/lesli/user_service.rb +1 -1
- data/app/views/lesli/layouts/application-devise.html.erb +6 -6
- data/app/views/lesli/layouts/application-lesli.html.erb +3 -1
- data/app/views/lesli/partials/_application-data.html.erb +5 -4
- data/app/views/lesli/partials/_application-lesli-engines.html.erb +14 -39
- data/app/views/lesli/partials/_application-lesli-header.html.erb +50 -25
- data/app/views/lesli/partials/_application-lesli-icons.html.erb +1 -1
- data/app/views/lesli/partials/_application-lesli-javascript.html.erb +2 -2
- data/app/views/lesli/partials/_application-lesli-navigation.html.erb +8 -1
- data/app/views/lesli/partials/_application-lesli-panels.html.erb +7 -7
- data/app/views/lesli/partials/_application-lesli-scss.html.erb +2 -2
- data/app/views/lesli/wrappers/_application-devise-simple.erb +1 -1
- data/app/views/lesli/wrappers/_application-devise.html.erb +5 -7
- data/config/initializers/devise.rb +335 -335
- data/config/initializers/lesli.rb +9 -2
- data/config/locales/translations.en.yml +9 -3
- data/config/locales/translations.es.yml +9 -3
- data/config/locales/translations.fr.yml +30 -0
- data/config/locales/translations.it.yml +30 -0
- data/config/locales/translations.pt.yml +30 -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/generators/application_lesli_generator.rb +164 -0
- data/lib/generators/lesli/spec/USAGE +8 -0
- data/lib/generators/lesli/spec/spec_generator.rb +25 -0
- data/lib/generators/lesli/spec/templates/spec-factory.template +17 -0
- data/lib/generators/lesli/spec/templates/spec-model.template +70 -0
- data/lib/lesli/configuration.rb +1 -1
- data/lib/lesli/engine.rb +3 -14
- data/lib/{scss/devise/passwords.scss → lesli/r_spec.rb} +12 -5
- data/lib/lesli/routing.rb +51 -20
- data/lib/lesli/version.rb +2 -2
- data/lib/lesli.rb +1 -0
- data/lib/scss/cloud-objects/discussion.scss +8 -5
- data/lib/scss/layouts/application-component.scss +1 -1
- data/lib/scss/{devise/sessions.scss → layouts/application-content.scss} +4 -4
- data/lib/scss/layouts/application-header.scss +38 -108
- data/lib/scss/layouts/{application-navbar.scss → application-navigation.scss} +23 -5
- data/lib/scss/layouts/application-search.scss +1 -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/settings/variables.scss +1 -1
- data/lib/scss/templates/application.scss +14 -41
- data/lib/scss/templates/public.scss +6 -4
- data/lib/tasks/lesli/controllers.rake +1 -1
- data/lib/tasks/lesli/db.rake +24 -12
- data/lib/tasks/lesli_tasks.rake +7 -7
- data/lib/vue/application.js +18 -15
- 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-component.vue +2 -2
- data/lib/vue/layouts/application-header.vue +109 -88
- data/lib/vue/panels/{panel-notifications.vue → panel-bell-notifications.vue} +15 -19
- data/lib/vue/panels/panel-support-tickets.vue +163 -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 +119 -2
- data/lib/webpack/base.js +18 -12
- data/lib/webpack/core.js +16 -12
- data/lib/webpack/engines.js +3 -1
- data/lib/webpack/root.js +105 -0
- data/lib/webpack/version.js +37 -0
- data/readme.md +16 -15
- metadata +58 -92
- data/app/assets/icons/lesli/engine-guard.svg +0 -1
- data/app/assets/javascripts/lesli/users/sessions.js +0 -1
- data/app/assets/stylesheets/lesli/users/sessions.css +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/scss/bulma/loader.scss +0 -92
- data/lib/scss/components/editor-richtext.scss +0 -88
- data/lib/scss/devise/oauth.scss +0 -34
- 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,66 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
class Users::ConfirmationsController < Devise::ConfirmationsController
|
3
|
-
|
4
|
-
def show
|
5
|
-
|
6
|
-
# delete all previus messages
|
7
|
-
flash.clear
|
8
|
-
|
9
|
-
# get the confirmation token sent through get params
|
10
|
-
token = params[:confirmation_token]
|
11
|
-
|
12
|
-
# validate that token were sent
|
13
|
-
if token.blank?
|
14
|
-
return flash[:danger] = I18n.t("core.users/confirmations.messages_warning_invalid_token")
|
15
|
-
end
|
16
|
-
|
17
|
-
# check if token belongs to a unconfirmed user
|
18
|
-
user = Lesli::User.find_by(:confirmation_token => token, :confirmed_at => nil)
|
19
|
-
|
20
|
-
# validate that user were found
|
21
|
-
if user.blank?
|
22
|
-
return flash[:danger] = I18n.t("core.users/confirmations.messages_warning_invalid_token")
|
23
|
-
end
|
24
|
-
|
25
|
-
# register a log with a validation atempt for the user
|
26
|
-
log = user.logs.create({ description: "confirmation_atempt_successful" })
|
27
|
-
|
28
|
-
registration_operator = Lesli::UserRegistrationOperator.new(user)
|
29
|
-
|
30
|
-
# confirm the user
|
31
|
-
registration_operator.confirm
|
32
|
-
|
33
|
-
# let the user knows that the confirmation is done
|
34
|
-
flash[:success] = I18n.t("core.users/confirmations.messages_success_email_updated")
|
35
|
-
|
36
|
-
# if new account, launch account onboarding in another thread,
|
37
|
-
# so the user can continue with the registration process
|
38
|
-
registration_operator.create_account if user.account.blank?
|
39
|
-
#Thread.new { registration_operator.create_account } if user.account.blank?
|
40
|
-
|
41
|
-
end
|
42
|
-
|
43
|
-
|
44
|
-
# @controller_action_param :email [String] The registered user email
|
45
|
-
# @return [Json] Json that contains wheter the email confirmation was sent or not.
|
46
|
-
# If it is not successful, it returs an error message
|
47
|
-
# @description Resends a email confirmation an already registered user
|
48
|
-
# @example
|
49
|
-
# # Executing this controller's action from javascript's frontend
|
50
|
-
# let email = 'john.doe@email.com';
|
51
|
-
# let data = {
|
52
|
-
# user: {
|
53
|
-
# email: email
|
54
|
-
# }
|
55
|
-
# };
|
56
|
-
# this.http.post('127.0.0.1/conformation', data);
|
57
|
-
def create
|
58
|
-
super do |resource|
|
59
|
-
if successfully_sent?(resource)
|
60
|
-
return respond_with_successful
|
61
|
-
else
|
62
|
-
return respond_with_error(resource.errors.full_messages.to_sentence)
|
63
|
-
end
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
@@ -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 %>
|