Module: PhcdevworksAccountsAuth0::ApplicationHelper

Defined in:
app/helpers/phcdevworks_accounts_auth0/application_helper.rb

Instance Method Summary collapse

Instance Method Details

#authenticate_user!Object



8
9
10
11
12
13
14
# File 'app/helpers/phcdevworks_accounts_auth0/application_helper.rb', line 8

def authenticate_user!
  if user_signed_in?
    @current_user = session['userinfo']
  else
    redirect_to root_path
  end
end

#current_userObject



16
17
18
# File 'app/helpers/phcdevworks_accounts_auth0/application_helper.rb', line 16

def current_user
  @current_user
end

#reset_sessionObject



20
21
22
# File 'app/helpers/phcdevworks_accounts_auth0/application_helper.rb', line 20

def reset_session
  session['userinfo'] = nil if session['userinfo'].present?
end

#user_signed_in?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'app/helpers/phcdevworks_accounts_auth0/application_helper.rb', line 4

def user_signed_in?
  session['userinfo'].present?
end