Sha256: bd7ec0bf65113eeff18a674aceb148d3a20824a1a4c06bb97b62810c9727d902

Contents?: true

Size: 897 Bytes

Versions: 15

Compression:

Stored size: 897 Bytes

Contents

%w(./app/models sinatra/base sinatra/flash).each { |lib| require lib }

require 'entrance/addons/omniauth'
require 'omniauth-twitter'

module Example

  class Routes < Sinatra::Base

    register Sinatra::Flash
    register Entrance::OmniAuth

    set :sessions, :secret => 'veryverysecretkey'
    set :views, File.expand_path(File.dirname(__FILE__)) + '/views'

    set :auth_test, true     # only true for testing
    set :auth_remember, true # enables 'remember me' for omniauth logins
    set :auth_providers, {
      :twitter => {
        :key => 'foobar',
        :secret => 'xoxoxoxox'
      }
    }

    before do
      login_required :except => ['/login']
    end

    get '/' do
      erb :welcome
    end

    get '/login' do
      erb :login
    end

    get '/logout' do
      logout!
      flash[:notice] = 'Logged out! See you soon.'
      redirect to('/login')
    end

  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
entrance-0.6.4 examples/sinatra-omniauth/app/routes.rb
entrance-0.6.3 examples/sinatra-omniauth/app/routes.rb
entrance-0.6.2 examples/sinatra-omniauth/app/routes.rb
entrance-0.6.1 examples/sinatra-omniauth/app/routes.rb
entrance-0.6.0 examples/sinatra-omniauth/app/routes.rb
entrance-0.5.3 examples/sinatra-omniauth/app/routes.rb
entrance-0.5.2 examples/sinatra-omniauth/app/routes.rb
entrance-0.5.1 examples/sinatra-omniauth/app/routes.rb
entrance-0.5.0 examples/sinatra-omniauth/app/routes.rb
entrance-0.4.8 examples/sinatra-omniauth/app/routes.rb
entrance-0.4.7 examples/sinatra-omniauth/app/routes.rb
entrance-0.4.6 examples/sinatra-omniauth/app/routes.rb
entrance-0.4.5 examples/sinatra-omniauth/app/routes.rb
entrance-0.4.4 examples/sinatra-omniauth/app/routes.rb
entrance-0.4.3 examples/sinatra-omniauth/app/routes.rb