Browse files

avoid querying database for empty auth token cookie

  • Loading branch information...
1 parent b6dbe06 commit f28f26cf59b8a81cf354dca294e8d370afac904a @jakimowicz jakimowicz committed with Jul 7, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 generators/authenticated/templates/authenticated_system.rb
View
2 generators/authenticated/templates/authenticated_system.rb
@@ -122,7 +122,7 @@ def login_from_basic_auth
# Called from #current_<%= file_name %>. Finaly, attempt to login by an expiring token in the cookie.
# for the paranoid: we _should_ be storing <%= file_name %>_token = hash(cookie_token, request IP)
def login_from_cookie
- <%= file_name %> = cookies[:auth_token] && <%= class_name %>.find_by_remember_token(cookies[:auth_token])
+ <%= file_name %> = cookies[:auth_token].not.blank? and <%= class_name %>.find_by_remember_token(cookies[:auth_token])
if <%= file_name %> && <%= file_name %>.remember_token?
self.current_<%= file_name %> = <%= file_name %>
handle_remember_cookie! false # freshen cookie token (keeping date)

0 comments on commit f28f26c

Please sign in to comment.