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.23.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.22.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.21.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.20.1 app/controllers/invitations_controller.rb
mumuki-laboratory-9.20.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.19.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.18.1 app/controllers/invitations_controller.rb
mumuki-laboratory-9.18.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.17.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.16.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.15.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.14.1 app/controllers/invitations_controller.rb
mumuki-laboratory-9.14.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.13.2 app/controllers/invitations_controller.rb
mumuki-laboratory-9.13.1 app/controllers/invitations_controller.rb
mumuki-laboratory-9.13.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.12.1 app/controllers/invitations_controller.rb
mumuki-laboratory-9.12.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.11.0 app/controllers/invitations_controller.rb
mumuki-laboratory-9.10.0 app/controllers/invitations_controller.rb