Sha256: 7dc33659d8b1379793a8a926e6882e987d9cb807668bdd616bab60979da69b4c

Contents?: true

Size: 803 Bytes

Versions: 32

Compression:

Stored size: 803 Bytes

Contents

class InvitationsController < ApplicationController
  before_action :authenticate!
  before_action :set_invitation!

  def show
    redirect_to_organization! if current_user.student_of? @organization
  end

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

  def authorize_if_private!
    # This controller must never be authenticated
  end

  private

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

  def user_params
    params.require(:user).permit(:name, :first_name, :last_name, :email)
  end

  def set_invitation!
    @invitation = Invitation.find_by_code params[:code]
    @organization = @invitation.organization
  end
end

Version data entries

32 entries across 32 versions & 1 rubygems

Version Path
mumuki-laboratory-6.1.5 app/controllers/invitations_controller.rb
mumuki-laboratory-6.0.4 app/controllers/invitations_controller.rb
mumuki-laboratory-6.1.4 app/controllers/invitations_controller.rb
mumuki-laboratory-6.1.3 app/controllers/invitations_controller.rb
mumuki-laboratory-6.0.3 app/controllers/invitations_controller.rb
mumuki-laboratory-6.1.2 app/controllers/invitations_controller.rb
mumuki-laboratory-6.1.1 app/controllers/invitations_controller.rb
mumuki-laboratory-6.1.0 app/controllers/invitations_controller.rb
mumuki-laboratory-6.0.2 app/controllers/invitations_controller.rb
mumuki-laboratory-6.0.1 app/controllers/invitations_controller.rb
mumuki-laboratory-6.0.0 app/controllers/invitations_controller.rb
mumuki-laboratory-5.13.0 app/controllers/invitations_controller.rb
mumuki-laboratory-5.12.1 app/controllers/invitations_controller.rb
mumuki-laboratory-5.12.0 app/controllers/invitations_controller.rb
mumuki-laboratory-5.11.0 app/controllers/invitations_controller.rb
mumuki-laboratory-5.10.4 app/controllers/invitations_controller.rb
mumuki-laboratory-5.10.3 app/controllers/invitations_controller.rb
mumuki-laboratory-5.10.2 app/controllers/invitations_controller.rb
mumuki-laboratory-5.10.1 app/controllers/invitations_controller.rb
mumuki-laboratory-5.10.0 app/controllers/invitations_controller.rb