Fingertips-authentication-needed-san 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +4 -0
- data/VERSION.yml +1 -1
- data/lib/authentication_needed_san.rb +6 -2
- data/test/authentication_needed_san_test.rb +14 -1
- metadata +4 -4
data/README.rdoc
CHANGED
data/VERSION.yml
CHANGED
@@ -60,7 +60,11 @@ module AuthenticationNeededSan
|
|
60
60
|
# redirected ‘back’ to the page she originally requested _before_
|
61
61
|
# authentication_needed! was called.
|
62
62
|
def finish_authentication_needed!
|
63
|
-
|
64
|
-
|
63
|
+
if authentication_needed?
|
64
|
+
flash.discard :after_authentication
|
65
|
+
redirect_to after_authentication[:redirect_to]
|
66
|
+
else
|
67
|
+
false
|
68
|
+
end
|
65
69
|
end
|
66
70
|
end
|
@@ -15,7 +15,7 @@ class TestController < ApplicationController
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def authenticate
|
18
|
-
finish_authentication_needed!
|
18
|
+
finish_authentication_needed! or redirect_to(some_other_url)
|
19
19
|
end
|
20
20
|
|
21
21
|
private
|
@@ -27,6 +27,10 @@ class TestController < ApplicationController
|
|
27
27
|
def new_session_url
|
28
28
|
"http://test/sessions/new"
|
29
29
|
end
|
30
|
+
|
31
|
+
def some_other_url
|
32
|
+
"http://test/manage/articles/new"
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
class AuthenticationNeededTest < ActionController::TestCase
|
@@ -82,6 +86,11 @@ class AuthenticationNeededTest < ActionController::TestCase
|
|
82
86
|
get :authenticate, {}, {}, flash
|
83
87
|
end
|
84
88
|
|
89
|
+
test "should return `false' when #finish_authentication_needed! is called but no :after_authentication data exists so the user can do something else" do
|
90
|
+
get :authenticate
|
91
|
+
assert_redirected_to some_other_url
|
92
|
+
end
|
93
|
+
|
85
94
|
private
|
86
95
|
|
87
96
|
def url_for(action)
|
@@ -92,6 +101,10 @@ class AuthenticationNeededTest < ActionController::TestCase
|
|
92
101
|
@controller.send :new_session_url
|
93
102
|
end
|
94
103
|
|
104
|
+
def some_other_url
|
105
|
+
@controller.send :some_other_url
|
106
|
+
end
|
107
|
+
|
95
108
|
def stubbed_flash
|
96
109
|
flash = { :after_authentication => { :redirect_to => new_session_url } }
|
97
110
|
@controller.stubs(:flash).returns(flash)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Fingertips-authentication-needed-san
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Duran
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-06-
|
12
|
+
date: 2009-06-11 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -31,7 +31,7 @@ files:
|
|
31
31
|
- rails/init.rb
|
32
32
|
- test/authentication_needed_san_test.rb
|
33
33
|
- test/test_helper.rb
|
34
|
-
has_rdoc:
|
34
|
+
has_rdoc: false
|
35
35
|
homepage: http://github.com/Fingertips/authentication-needed-san
|
36
36
|
post_install_message:
|
37
37
|
rdoc_options:
|
@@ -55,7 +55,7 @@ requirements: []
|
|
55
55
|
rubyforge_project:
|
56
56
|
rubygems_version: 1.2.0
|
57
57
|
signing_key:
|
58
|
-
specification_version:
|
58
|
+
specification_version: 3
|
59
59
|
summary: A thin wrapper around the Rails `flash' object to assist in redirecting the user `back' after authentication.
|
60
60
|
test_files:
|
61
61
|
- test/authentication_needed_san_test.rb
|