Sha256: ce1ba3217e73fd449a3d1ba9b8d78fac342eb9c2eff08f841ef849cda64cb6fd

Contents?: true

Size: 1.12 KB

Versions: 80

Compression:

Stored size: 1.12 KB

Contents

module Registrations::ControllerBase
  extend ActiveSupport::Concern

  included do
    def new
      if invitation_only?
        unless session[:invitation_uuid] || session[:invitation_key]
          return redirect_to root_path
        end
      end

      # do all the regular devise stuff.
      super
    end

    def create
      # do all the regular devise stuff first.
      super

      # if current_user is defined, that means they were successful registering.
      if current_user

        # TODO i think this might be redundant. we've added a hook into `session["user_return_to"]` in the
        # `invitations#accept` action and that might be enough to get them where they're supposed to be after
        # either creating a new account or signing into an existing account.
        handle_outstanding_invitation

        # if the user doesn't have a team at this point, create one.
        unless current_user.teams.any?
          current_user.create_default_team
        end

        # send the welcome email.
        current_user.send_welcome_email unless current_user.email_is_oauth_placeholder?

      end
    end
  end
end

Version data entries

80 entries across 80 versions & 1 rubygems

Version Path
bullet_train-1.0.98 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.97 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.96 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.95 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.93 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.92 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.90 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.89 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.88 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.87 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.86 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.85 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.83 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.81 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.79 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.76 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.75 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.74 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.72 app/controllers/concerns/registrations/controller_base.rb
bullet_train-1.0.71 app/controllers/concerns/registrations/controller_base.rb