Sha256: b02680a3ffca8e239eef7e6deb796da28ed9bdf884868b4a712887140535f5fb

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

module Users
  class RegistrationsController < Devise::RegistrationsController
    before_action do
      @sidebar = false
      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?
          # FIXME: no va más
          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

11 entries across 11 versions & 1 rubygems

Version Path
pg_rails-7.6.21.pre.11 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.10 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.9 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.8 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.7 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.6 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.5 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.4 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.3 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.2 pg_engine/app/controllers/users/registrations_controller.rb
pg_rails-7.6.21.pre.1 pg_engine/app/controllers/users/registrations_controller.rb