Browse Source

Should authenticate by user username, not email

denney-fix-saving-dates
Jason Denney 11 years ago
parent
commit
64e907b6f7
  1. 2
      app/controllers/api/v1/base_controller.rb
  2. 2
      spec/support/api_test_helpers.rb

2
app/controllers/api/v1/base_controller.rb

@ -6,7 +6,7 @@ class Api::V1::BaseController < ActionController::Base
private
def authenticate_user
if params[:username]
user = User.find_for_database_authentication( :email => params[:username] )
user = User.find_for_database_authentication( :username => params[:username] )
@current_user = user if user && user.valid_password?( params[:password] )
if @current_user.nil?

2
spec/support/api_test_helpers.rb

@ -1,5 +1,5 @@
module ApiTestHelpers
def api_submit_json(user, json_hash)
json_hash.merge({username: user.email, password: user.password})
json_hash.merge({username: user.username, password: user.password})
end
end

Loading…
Cancel
Save