Class: Users::InvitationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/users/invitations_controller.rb

Instance Method Summary collapse

Instance Method Details

#receiveObject


3
4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/users/invitations_controller.rb', line 3

def receive
  code = params[:code]
  if InvitationCodeService.verify(code)
    sign_out :user
    SignonStatusTokenService.update_cookie(cookies, current_user)
    SiteIdentityTokenService.update(cookies, current_user)
    session[:invitation_code] = code
    session[:invitation_redirect_url] = params[:redirect_to]
    redirect_to new_user_session_path
  else
    flash[:alert] = "無效的邀請碼!"
    redirect_to root_path
  end
end

#rejectObject


18
19
20
21
# File 'app/controllers/users/invitations_controller.rb', line 18

def reject
  session[:invitation_code] = nil
  redirect_to new_user_session_path
end