lib/devise/models/lockable.rb in devise-3.5.8 vs lib/devise/models/lockable.rb in devise-3.5.9

- old
+ new

@@ -153,10 +153,13 @@ false end end module ClassMethods + # List of strategies that are enabled/supported if :both is used. + BOTH_STRATEGIES = [:time, :email] + # Attempt to find a user by its unlock keys. If a record is found, send new # unlock instructions to it. If not user is found, returns a new user # with an email not found error. # Options must contain the user's unlock keys def send_unlock_instructions(attributes={}) @@ -179,10 +182,11 @@ lockable end # Is the unlock enabled for the given unlock strategy? def unlock_strategy_enabled?(strategy) - [:both, strategy].include?(self.unlock_strategy) + self.unlock_strategy == strategy || + (self.unlock_strategy == :both && BOTH_STRATEGIES.include?(strategy)) end # Is the lock enabled for the given lock strategy? def lock_strategy_enabled?(strategy) self.lock_strategy == strategy