Sha256: e0779fefb995d7c46dbc9ce301b76ba480fc9f343775aab91ec9459bffc3c22f

Contents?: true

Size: 972 Bytes

Versions: 57

Compression:

Stored size: 972 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 :validate_accepted_role_terms!
  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_and_notify! user_params
    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

57 entries across 57 versions & 1 rubygems

Version Path
mumuki-laboratory-9.0.5 app/controllers/invitations_controller.rb
mumuki-laboratory-9.0.4 app/controllers/invitations_controller.rb
mumuki-laboratory-9.0.3 app/controllers/invitations_controller.rb
mumuki-laboratory-9.0.2 app/controllers/invitations_controller.rb
mumuki-laboratory-9.0.1 app/controllers/invitations_controller.rb
mumuki-laboratory-9.0.0 app/controllers/invitations_controller.rb
mumuki-laboratory-8.6.1 app/controllers/invitations_controller.rb
mumuki-laboratory-8.6.0 app/controllers/invitations_controller.rb
mumuki-laboratory-8.5.0 app/controllers/invitations_controller.rb
mumuki-laboratory-8.4.0 app/controllers/invitations_controller.rb
mumuki-laboratory-8.3.0 app/controllers/invitations_controller.rb
mumuki-laboratory-8.2.1 app/controllers/invitations_controller.rb
mumuki-laboratory-8.2.0 app/controllers/invitations_controller.rb
mumuki-laboratory-8.1.3 app/controllers/invitations_controller.rb
mumuki-laboratory-8.1.2 app/controllers/invitations_controller.rb
mumuki-laboratory-8.1.1 app/controllers/invitations_controller.rb
mumuki-laboratory-8.1.0 app/controllers/invitations_controller.rb