File tree Expand file tree Collapse file tree
app/controllers/open_sesame Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99 - secure : oQs2AG/S1KoECnRqrg8htnB+D8lbrphR2RCz8GbYkCzK8ksR0scXM/kBnhV0oTel1H2mMPU29Gopr/uL+gcExVTF+nMOGZh5guTpZdWD49AnWQqIdKGlpyzOBGHPw3A1a9h50lLQi/CEmoDkeAMwA0pAFt5MRgLELPU9O3p/t8Q=
1010 - secure : TUP2EXBw9M+pRSfjfFNKpcr8cxksg38tco4NvLsHZE5skuzMsxTaL/KG0gf7/GqQI1xxpFwj2SFD3NtKRDf5mJHeRQtsVPHznnFJ1GtekVy9PE3/ixppfF5Y32JIYFbjBxoZ9Qfa9P7aY8tBnfShzXw6yGkzsEApIT35WnGCbbM=
1111rvm :
12+ - 2.1.0
1213- 2.0.0
1314- 1.9.3
1415before_script : sh -c 'cd spec/dummy && bundle exec rake db:create db:migrate'
16+ cache : bundler
Original file line number Diff line number Diff line change 2121end
2222
2323gem "pry"
24- gem "pry-debugger"
24+ gem "pry-debugger" , :platforms => :mri_19
25+ gem "pry-byebug" , :platforms => [ :mri_20 , :mri_21 ]
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ OpenSesame.configure do |config|
3434 config.github ENV [' GITHUB_APP_ID' ], ENV [' GITHUB_SECRET' ]
3535 config.organization ' challengepost'
3636 config.mounted_at ' /opensesame'
37+
38+ config.redirect_to ' /path' # Set redirect to for both login and logout
39+ config.redirect_after_login ' /path'
40+ config.redirect_after_logout ' /path'
3741end
3842```
3943
Original file line number Diff line number Diff line change @@ -15,12 +15,12 @@ def new
1515
1616 def create
1717 login_opensesame
18- redirect_to main_app . root_url
18+ redirect_to after_login_path
1919 end
2020
2121 def destroy
2222 logout_opensesame
23- redirect_to main_app . root_url
23+ redirect_to after_logout_path
2424 end
2525
2626 def failure
@@ -68,5 +68,13 @@ def logout_opensesame
6868 flash [ :notice ] = "Logged out!"
6969 end
7070
71+ def after_login_path
72+ OpenSesame . after_login_path || main_app . root_url
73+ end
74+
75+ def after_logout_path
76+ OpenSesame . after_logout_path || main_app . root_url
77+ end
78+
7179 end
7280end
Original file line number Diff line number Diff line change @@ -10,7 +10,9 @@ class Configuration
1010 :enabled ,
1111 :debug ,
1212 :full_host ,
13- :auto_access_provider
13+ :auto_access_provider ,
14+ :after_login_path ,
15+ :after_logout_path
1416 ]
1517 attr_accessor *CONFIGURABLE_ATTRIBUTES
1618
@@ -50,6 +52,19 @@ def enable(enabled)
5052 self . enabled = !!enabled
5153 end
5254
55+ def redirect_to ( to )
56+ self . after_login_path = to
57+ self . after_logout_path = to
58+ end
59+
60+ def redirect_after_login ( to )
61+ self . after_login_path = to
62+ end
63+
64+ def redirect_after_logout ( to )
65+ self . after_logout_path = to
66+ end
67+
5368 def enabled?
5469 !!self . enabled
5570 end
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ class Engine < ::Rails::Engine
1616 include OpenSesame ::Helpers ::ViewHelper
1717 end
1818
19- initializer "openseseame precompile" do |app |
19+ initializer "opensesame. precompile" do |app |
2020 app . config . assets . precompile += [ 'open_sesame/opensesame.css' ]
2121 end
2222
Original file line number Diff line number Diff line change 3131 configuration . auto_access_provider . should == "github"
3232 end
3333
34+ it "sets all redirects to" do
35+ configuration . redirect_to "/foobar"
36+ configuration . after_login_path . should == "/foobar"
37+ configuration . after_logout_path . should == "/foobar"
38+ end
39+
40+ it "sets after_login path" do
41+ configuration . redirect_after_login "/foobar"
42+ configuration . after_login_path . should == "/foobar"
43+ end
44+
45+ it "sets after_logout redirect_to" do
46+ configuration . redirect_after_logout "/foobar"
47+ configuration . after_logout_path . should == "/foobar"
48+ end
49+
3450 describe "valid?" do
3551 it "false when values not set" do
3652 configuration . organization "challengepost"
You can’t perform that action at this time.
0 commit comments