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

Commit

Permalink
redirect to the root url if the sso login url is hit without a return…
Browse files Browse the repository at this point in the history
…_to address and the user is logged in, bump to version 0.0.3
  • Loading branch information
atmos committed Mar 21, 2009
1 parent d22390f commit cb180a2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require 'spec/rake/spectask'
require 'cucumber/rake/task'

GEM = "hancock"
GEM_VERSION = "0.0.2"
GEM_VERSION = "0.0.3"
AUTHOR = ["Corey Donohoe", "Tim Carey-Smith"]
EMAIL = [ "atmos@atmos.org", "tim@spork.in" ]
HOMEPAGE = "http://github.com/atmos/hancock"
Expand Down
3 changes: 2 additions & 1 deletion lib/sinatra/hancock/sessions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def ensure_authenticated
session['return_to'] = trust_root
end
else
throw(:halt, [403, 'Forbidden'])
forbidden!
end
end
throw(:halt, [401, haml(:unauthenticated)]) unless session_user
Expand All @@ -32,6 +32,7 @@ def self.registered(app)
app.template(:unauthenticated) { sessions_template('unauthenticated') }
app.get '/sso/login' do
ensure_authenticated
redirect '/'
end
app.post '/sso/login' do
@user = ::Hancock::User.authenticate(params['email'], params['password'])
Expand Down
4 changes: 2 additions & 2 deletions spec/features/sessions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Feature: Logging In to an SSO Account
When I login
Then I should be redirected to the sso provider root on login
Scenario: logging in with a bad return_to cookie set
Given I am logged in on the sso provider
And a valid consumer and user exists
Given a valid consumer and user exists
Then I login
When I request the login page
Then I should be redirected to the sso provider root

0 comments on commit cb180a2

Please sign in to comment.