lib/sinatra/auth/github.rb in sinatra_auth_github-0.1.0 vs lib/sinatra/auth/github.rb in sinatra_auth_github-0.1.1

- old
+ new

@@ -3,12 +3,18 @@ require 'rest_client' module Sinatra module Auth module Github - VERSION = "0.1.0" + VERSION = "0.1.1" + class AccessDenied < Sinatra::Base + get '/_images/securocat.png' do + send_file(File.join(File.dirname(__FILE__), "views", "securocat.png")) + end + end + class BadAuthentication < Sinatra::Base helpers do def unauthorized_template @unauthenticated_template ||= File.read(File.join(File.dirname(__FILE__), "views", "401.html")) end @@ -106,10 +112,11 @@ request.script_name + path end end def self.registered(app) + app.use AccessDenied app.use Warden::Manager do |manager| manager.default_strategies :github manager.failure_app = app.github_options[:failure_app] || BadAuthentication @@ -125,12 +132,9 @@ app.get '/auth/github/callback' do authenticate! redirect _relative_url_for('/') end - app.get '/_images/securocat.png' do - send_file(File.join(File.dirname(__FILE__), "views", "securocat.png")) - end end end end end