Sha256: 6918b8ff4fb6e6bda907b3224703208e3f46305cd70aec0b24dbcccc484e96e9
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
module Users class RegistrationsController < Devise::RegistrationsController before_action do authorize resource, nil, policy_class: UserRegistrationPolicy end # GET /resource/sign_up def new build_resource(accept_terms: true) yield resource if block_given? respond_with resource 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
3 entries across 3 versions & 1 rubygems