Module: Sinatra::DataMapperAuth::Helpers

Defined in:
lib/sinatra/datamapperauth.rb

Instance Method Summary collapse

Instance Method Details

#authorize!Object



49
50
51
# File 'lib/sinatra/datamapperauth.rb', line 49

def authorize!
  redirect '/login' unless authorized?
end

#authorized?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/sinatra/datamapperauth.rb', line 46

def authorized?
  return true if session[:user]
end

#logout!Object



52
53
54
# File 'lib/sinatra/datamapperauth.rb', line 52

def logout!
  session[:user] = false
end