@@ -83,6 +83,8 class User < ActiveRecord::Base | |||||
83 |
|
83 | |||
84 | # Returns the user that matches provided login and password, or nil |
|
84 | # Returns the user that matches provided login and password, or nil | |
85 | def self.try_to_login(login, password) |
|
85 | def self.try_to_login(login, password) | |
|
86 | # Make sure no one can sign in with an empty password | |||
|
87 | return nil if password.to_s.empty? | |||
86 | user = find(:first, :conditions => ["login=?", login]) |
|
88 | user = find(:first, :conditions => ["login=?", login]) | |
87 | if user |
|
89 | if user | |
88 | # user is already in local database |
|
90 | # user is already in local database |
General Comments 0
You need to be logged in to leave comments.
Login now