From 4221f5edb310287f07f005945f70b4a48ad9a1c2 Mon Sep 17 00:00:00 2001 From: alan <547533434@qq.com> Date: Sun, 23 Nov 2014 11:48:59 +0800 Subject: [PATCH] =?UTF-8?q?<=E8=BF=98=E5=8E=9F>=20Signed-off-by:=20alan=20?= =?UTF-8?q?<547533434@qq.com>?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 32cfefa9d..cab5ada7c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -124,7 +124,7 @@ class ApplicationController < ActionController::Base else # HTTP Basic, either username/password or API key/random authenticate_with_http_basic do |username, password| - user = User.try_to_login(username, password)[0] || User.find_by_api_key(username) + user = User.try_to_login(username, password) || User.find_by_api_key(username) end end # Switch user if requested by an admin user