lib/authentication_needed_san.rb in Fingertips-authentication-needed-san-1.1.0 vs lib/authentication_needed_san.rb in Fingertips-authentication-needed-san-1.1.1
- old
+ new
@@ -57,9 +57,19 @@
end
# Finish the after_authentication flow, which means the user will be
# redirected ‘back’ to the page she originally requested _before_
# authentication_needed! was called.
+ #
+ # This method returns +false+ if no authentication was needed, this way you
+ # can easily specify a default redirection:
+ #
+ # class SessionsController < ApplicationController
+ # def create
+ # # login code...
+ # finish_authentication_needed! or redirect_to(root_url)
+ # end
+ # end
def finish_authentication_needed!
if authentication_needed?
flash.discard :after_authentication
redirect_to after_authentication[:redirect_to]
else
\ No newline at end of file