Skip to content
This repository has been archived by the owner on Sep 28, 2021. It is now read-only.

Commit

Permalink
Hancock::App won't work if you inherit from it, use the options varia…
Browse files Browse the repository at this point in the history
…ble to access class
  • Loading branch information
atmos committed Mar 19, 2009
1 parent 264f5b4 commit c162f34
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions examples/dragon/config.ru
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,26 @@ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'lib', 'h
DataMapper.setup(:default, "sqlite3:///#{Dir.pwd}/development.db")
DataMapper.auto_migrate!

Sinatra::Mailer.delivery_method = :test_send # don't really send email notifications

Hancock::Consumer.create(:url => 'http://localhost:5000/sso/login', :label => 'Local Dev', :internal => false)
Hancock::Consumer.create(:url => 'http://localhost:5001/sso/login', :label => 'Human Resources', :internal => true)
Hancock::Consumer.create(:url => 'http://localhost:5002/sso/login', :label => 'Remote Dev', :internal => false)
Hancock::Consumer.create(:url => 'http://localhost:5003/sso/login', :label => 'Remote Calendaring', :internal => false)
Hancock::Consumer.create(:url => 'http://localhost:5004/sso/login', :label => 'Break Dance Pool', :internal => true)
Hancock::Consumer.create(:url => 'http://localhost:5003/sso/login', :label => 'Library Book Reminder', :internal => false)

Hancock::App.set :views, 'views'
Hancock::App.set :public, 'public'
Hancock::App.set :environment, :production
run Hancock::App
class Dragon < Hancock::App
set :views, 'views'
set :public, 'public'
set :environment, :production

set :provider_name, 'Example SSO Provider'
set :do_not_reply, 'sso@example.com'

get '/' do
redirect '/sso/login' unless session[:user_id]
erb "<h2>Hello <%= session[:first_name] %><!-- <%= session.inspect %>"
end
end
run Dragon
4 changes: 2 additions & 2 deletions lib/sinatra/hancock/users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def self.registered(app)

app.post '/sso/signup' do
@user = ::Hancock::User.signup(params)
from = ::Hancock::App.do_not_reply
from = options.do_not_reply

if @user.save
raise ::Hancock::ConfigurationError.new("You need to define Hancock::App.email_address") unless from
raise ::Hancock::ConfigurationError.new("You need to define options.do_not_reply") unless from
@registration_url = absolute_url("/sso/register/#{@user.access_token}")
email :to => @user.email,
:from => from,
Expand Down

0 comments on commit c162f34

Please sign in to comment.