Fingertips-authentication-needed-san 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +10 -0
- data/VERSION.yml +1 -1
- data/lib/authentication_needed_san.rb +10 -0
- data/rails/init.rb +1 -1
- metadata +1 -1
data/README.rdoc
CHANGED
@@ -28,5 +28,15 @@ ApplicationController would look something like the following:
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
Then from your sessions controller redirect the user back to the page she
|
32
|
+
requested or the default one:
|
33
|
+
|
34
|
+
class SessionsController < ApplicationController
|
35
|
+
def create
|
36
|
+
# login code...
|
37
|
+
finish_authentication_needed! or redirect_to(root_url)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
31
41
|
The authorization-san plugin is available at:
|
32
42
|
http://github.com/Fingertips/authorization-san
|
data/VERSION.yml
CHANGED
@@ -59,6 +59,16 @@ module AuthenticationNeededSan
|
|
59
59
|
# Finish the after_authentication flow, which means the user will be
|
60
60
|
# redirected ‘back’ to the page she originally requested _before_
|
61
61
|
# authentication_needed! was called.
|
62
|
+
#
|
63
|
+
# This method returns +false+ if no authentication was needed, this way you
|
64
|
+
# can easily specify a default redirection:
|
65
|
+
#
|
66
|
+
# class SessionsController < ApplicationController
|
67
|
+
# def create
|
68
|
+
# # login code...
|
69
|
+
# finish_authentication_needed! or redirect_to(root_url)
|
70
|
+
# end
|
71
|
+
# end
|
62
72
|
def finish_authentication_needed!
|
63
73
|
if authentication_needed?
|
64
74
|
flash.discard :after_authentication
|
data/rails/init.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'authentication_needed_san'
|
2
|
-
|
2
|
+
ActionController::Base.send(:include, AuthenticationNeededSan)
|