lib/warden/strategies/base.rb in warden-0.9.0 vs lib/warden/strategies/base.rb in warden-0.9.1
- old
+ new
@@ -6,12 +6,12 @@
#
# The Warden::Strategies.add method is a simple way to provide custom strategies.
# You _must_ declare an @authenticate!@ method.
# You _may_ provide a @valid?@ method.
# The valid method should return true or false depending on if the strategy is a valid one for the request.
- #
- # The parameters for Warden::Strategies.add method is:
+ #
+ # The parameters for Warden::Strategies.add method is:
# <label: Symbol> The label is the name given to a strategy. Use the label to refer to the strategy when authenticating
# <strategy: Class|nil> The optional stragtegy argument if set _must_ be a class that inherits from Warden::Strategies::Base and _must_
# implement an @authenticate!@ method
# <block> The block acts as a convinient way to declare your strategy. Inside is the class definition of a strategy.
#
@@ -108,12 +108,13 @@
#
# Parameters:
# user - The user object to login. This object can be anything you have setup to serialize in and out of the session
#
# :api: public
- def success!(user)
+ def success!(user, message = nil)
halt!
- @user = user
+ @user = user
+ @message = message
@result = :success
end
# This causes the strategy to fail. It does not throw an :warden symbol to drop the request out to the failure application
# You must throw an :warden symbol somewhere in the application to enforce this