Class: OauthIm::ClientController

Inherits:
ApplicationController show all
Defined in:
app/controllers/oauth_im/client_controller.rb

Instance Method Summary collapse

Instance Method Details

#callbackObject



13
14
15
16
# File 'app/controllers/oauth_im/client_controller.rb', line 13

def callback
  session[:user_jwt] = user_jwt
  callback_redirect
end

#callback_redirectObject



18
19
20
21
22
23
24
25
26
27
# File 'app/controllers/oauth_im/client_controller.rb', line 18

def callback_redirect
  # Fetch the original page the user was on just prior to logging in.
  # If it's not available, default to the root path.
  referer_path = session.fetch(:oauth_im_login_referer, '').strip
  if referer_path.empty?
    redirect_to main_app.root_path
  else
    redirect_to referer_path
  end
end

#local_loginObject



41
42
43
44
45
46
# File 'app/controllers/oauth_im/client_controller.rb', line 41

def 
  head :forbidden if Rails.env.production?

  session[:userinfo] = 
  redirect_back fallback_location: main_app.root_path
end

#local_logoutObject



48
49
50
51
52
53
# File 'app/controllers/oauth_im/client_controller.rb', line 48

def local_logout
  head :forbidden if Rails.env.production?

  reset_session
  redirect_back fallback_location: main_app.root_path
end

#loginObject



29
30
31
32
33
34
# File 'app/controllers/oauth_im/client_controller.rb', line 29

def 
  # Set the referer path, if available, so that we can put the user
  # back on the page they were at before they decided the log in.
  session[:oauth_im_login_referer] = request.referer
  redirect_to oauth_client., allow_other_host: true
end

#logoutObject



36
37
38
39
# File 'app/controllers/oauth_im/client_controller.rb', line 36

def logout
  reset_session
  redirect_to oauth_client.logout_url, allow_other_host: true
end