fix a npe, and need a patch for path_info

This commit is contained in:
Saito 2012-06-29 21:40:23 +08:00
parent 7888e3ae29
commit aefe4dc3a2
1 changed files with 4 additions and 1 deletions

View File

@ -5,7 +5,10 @@ module Grack
# Authentication with username and password
email, password = @auth.credentials
user = User.find_by_email(email)
return false unless user.valid_password?(password)
return false unless user.try(:valid_password?, password)
# Need this patch because the rails mount
@env['PATH_INFO'] = @env['REQUEST_PATH']
# Find project by PATH_INFO from env
if m = /^\/([\w-]+).git/.match(@env['PATH_INFO']).to_a