Sha256: 28841041739a3de25449549b84eaa907a59024d75f7430bba3558d23a863a578

Contents?: true

Size: 934 Bytes

Versions: 25

Compression:

Stored size: 934 Bytes

Contents

class InvitationsController < ApplicationController
  include WithUserParams

  before_action :authenticate!
  before_action :set_invitation!
  before_action :set_user!

  skip_before_action :validate_user_profile!
  skip_before_action :authorize_if_private!
  skip_before_action :validate_active_organization!

  def show
    redirect_to_organization! if current_user.student_of? @invitation.course
  end

  def join
    current_user.accept_invitation! @invitation
    current_user.update! user_params
    current_user.notify!
    redirect_to_organization!
  end

  private

  def redirect_to_organization!
    redirect_to Mumukit::Platform.laboratory.organic_url(@organization)
  end

  def permissible_params
    super + [:email, :name]
  end

  def set_invitation!
    @invitation = Invitation.locate!(params[:code]).unexpired
    @organization = @invitation.organization
  end

  def set_user!
    @user = current_user
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
mumuki-laboratory-7.12.3 app/controllers/invitations_controller.rb
mumuki-laboratory-7.12.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.12.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.11.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.11.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.10.5 app/controllers/invitations_controller.rb
mumuki-laboratory-7.10.4 app/controllers/invitations_controller.rb
mumuki-laboratory-7.10.3 app/controllers/invitations_controller.rb
mumuki-laboratory-7.10.2 app/controllers/invitations_controller.rb
mumuki-laboratory-7.10.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.10.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.9.2 app/controllers/invitations_controller.rb
mumuki-laboratory-7.9.1 app/controllers/invitations_controller.rb
mumuki-laboratory-7.9.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.7.6 app/controllers/invitations_controller.rb
mumuki-laboratory-7.7.5 app/controllers/invitations_controller.rb
mumuki-laboratory-7.7.4 app/controllers/invitations_controller.rb
mumuki-laboratory-7.8.0 app/controllers/invitations_controller.rb
mumuki-laboratory-7.7.3 app/controllers/invitations_controller.rb
mumuki-laboratory-7.7.2 app/controllers/invitations_controller.rb