Sha256: c49fe5e2be8b2a66ea72bc1f8a4415fe2001d81d63e578c63aee451f7ec3ea39

Contents?: true

Size: 656 Bytes

Versions: 7

Compression:

Stored size: 656 Bytes

Contents

class TestingLogin < Sinatra::Base
  register Sinatra::Warden

  set :views, File.join(File.dirname(__FILE__), 'views')
  set :sessions, true

  set :auth_success_path, '/welcome'
  get '/dashboard' do
    authorize!('/login')
    "My Dashboard"
  end

  get '/warden' do
    authorize!
    "#{warden}"
  end

  get '/check_login' do
    logged_in? ? "Hello Moto" : "Get out!"
  end

  get '/account' do
    authorize!
    "#{user.email}'s account page"
  end

  post '/login_as' do
    authorize!
    self.user = User.authenticate(params['email'], params['password'])
  end

  get '/admin' do
    authorize!
    "Welcome #{current_user.email}"
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sinatra_warden-0.2.0.2 spec/fixtures/testing_login.rb
sinatra_warden-0.2.0.1 spec/fixtures/testing_login.rb
sinatra_warden-0.2.0 spec/fixtures/testing_login.rb
sinatra_warden-0.1.9 spec/fixtures/testing_login.rb
sinatra_warden-0.1.8 spec/fixtures/testing_login.rb
sinatra_warden-0.1.7 spec/fixtures/testing_login.rb
sinatra_warden-0.1.6 spec/fixtures/testing_login.rb