Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: slim
Fetching contributors…

Cannot retrieve contributors at this time

file 40 lines (32 sloc) 0.7 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
require 'sinatra/base'
require 'sinatra_warden'
require 'rack/flash'

require 'app/warden'
require 'app/user'
require 'slim'

module Sinatra
  module Templates
    def slim(template, options={}, locals={})
      render :slim, template, options, locals
    end
  end
end

class App < Sinatra::Base
  # Hack so that sinatra-warden uses slim
  def haml(*options)
    slim(*options)
  end
  
  set :app_file, __FILE__

  enable :sessions
  use Rack::Flash
  use Rack::Session::Cookie

  use Warden::Manager do |manager|
    manager.default_strategies :password
    manager.failure_app = App
  end
  
  register Sinatra::Warden
  set :auth_failure_path, '/login'

  get "/" do
    slim :welcome
  end
end
Something went wrong with that request. Please try again.