Sha256: 9d8c4283bbb4d26616b007f0ac9dea6505f2fd4c5655804e0f2ecf810f8bc9c7

Contents?: true

Size: 776 Bytes

Versions: 17

Compression:

Stored size: 776 Bytes

Contents

class InvitationsController < ApplicationController
  before_action :set_invitation!

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

  def join
    current_user.make_student_of! @invitation.course
    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

17 entries across 17 versions & 1 rubygems

Version Path
mumuki-laboratory-5.2.1 app/controllers/invitations_controller.rb
mumuki-laboratory-5.2.0 app/controllers/invitations_controller.rb
mumuki-laboratory-5.1.1 app/controllers/invitations_controller.rb
mumuki-laboratory-5.1.0 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.12 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.11 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.10 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.9 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.8 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.7 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.6 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.5 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.4 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.3 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.2 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.1 app/controllers/invitations_controller.rb
mumuki-laboratory-5.0.0 app/controllers/invitations_controller.rb