Class: Users::RegistrationsController

Inherits:
Devise::RegistrationsController
  • Object
show all
Defined in:
app/controllers/users/registrations_controller.rb

Overview

Lesli

Copyright © 2025, Lesli Technologies, S. A.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see www.gnu.org/licenses/.

Lesli · Ruby on Rails SaaS Development Framework.

Made with ♥ by LesliTech Building a better future, one line of code at a time.

// · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ // ·

Instance Method Summary collapse

Instance Method Details

#createObject

GET /resource/sign_up def new

super

end



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'app/controllers/users/registrations_controller.rb', line 44

def create
    begin

        # Check if instance allow multi-account
        if !Lesli.config.security.dig(:allow_registration)
            raise(I18n.t("core.users/registrations.messages_error_registration_not_allowed"))
        end

        # build new user
        user = build_resource()

        # persist new user
        if user.save
            user.log(engine: LesliShield, source: self.class.name, action: action_name, operation: 'user_creation', description: 'User creation successfully')
            success("Account created, check your email")
        else
            raise(user.errors.full_messages.to_sentence)
        end
    rescue => exception
        #Honeybadger.notify(exception)
        danger(exception.message)
    end
    redirect_to(new_user_registration_path)
end