Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit RegistrationsController#create to use ResourceFinder::provider #998

Merged
merged 3 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def get_case_insensitive_field_from_resource_params(field)
def find_resource(field, value)
# fix for mysql default case insensitivity
q = "#{field.to_s} = ? AND provider='#{provider.to_s}'"

if ActiveRecord::Base.connection.adapter_name.downcase.starts_with? 'mysql'
q = "BINARY " + q
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/devise_token_auth/passwords_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create
end

@email = get_case_insensitive_field_from_resource_params(:email)
@resource = find_resource(:uid, @email)
@resource = find_resource(:uid, @email, provider)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You forgot to remove from here


@errors = nil
@error_status = 400
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class RegistrationsController < DeviseTokenAuth::ApplicationController

def create
@resource = resource_class.new(sign_up_params)
@resource.provider = "email"
@resource.provider = provider

# honor devise configuration for case_insensitive_keys
if resource_class.case_insensitive_keys.include?(:email)
Expand Down