app/models/model_mixin.rb in quo_vadis-1.2.0 vs app/models/model_mixin.rb in quo_vadis-1.2.1
- old
+ new
@@ -26,9 +26,10 @@
instance_eval <<-END, __FILE__, __LINE__ + 1
# Returns the user with the given <tt>username</tt> if the given password is
# correct, and <tt>nil</tt> otherwise.
def authenticate(username, plain_text_password)
+ return nil unless username.present?
user = where(:username => username).first
if user && user.has_matching_password?(plain_text_password)
user
else
nil