Sha256: 2bed8c4b7376d60434059919c69a0af568c57853a8a778de0589783771dba89f

Contents?: true

Size: 1.03 KB

Versions: 10

Compression:

Stored size: 1.03 KB

Contents

module Users
  class RegistrationsController < Devise::RegistrationsController
    before_action do
      authorize resource, nil, policy_class: UserRegistrationPolicy
    end

    def create
      build_resource(sign_up_params)

      ActiveRecord::Base.transaction do
        resource.save
        yield resource if block_given?
        if resource.persisted?
          create_account_for(resource) if ActsAsTenant.current_tenant.blank?

          expire_data_after_sign_in!
          render_message
        else
          clean_up_passwords resource
          set_minimum_password_length
          respond_with resource
        end
      end
    end

    def render_message
      msg = <<~HTML
        <div class="alert alert-info mt-4 d-inline-block">
          #{I18n.t 'devise.registrations.signed_up_but_unconfirmed'}
        </div>
      HTML
      render turbo_stream: turbo_stream.update('form-signup', msg)
    end

    private

    def create_account_for(user)
      Account.create!(nombre: user.email, creado_por: user)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pg_rails-7.6.24 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.24.pre.5 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.24.pre.4 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.24.pre.3 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.23 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.22 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.22.pre.3 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.22.pre.2 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.22.pre.1 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21 pg_engine/app/controllers/users/registrations_controller.rb