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

Stop mutating username to downcase #806

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all 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
6 changes: 3 additions & 3 deletions lib/sorcery/model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def authenticate(*credentials)
return false if credentials[0].blank?

if @sorcery_config.downcase_username_before_authenticating
credentials[0].downcase!
credentials[0] = credentials[0].downcase
end

user = sorcery_adapter.find_by_credentials(credentials)
Expand Down Expand Up @@ -117,7 +117,7 @@ def set_encryption_attributes()
@sorcery_config.encryption_provider.stretches = @sorcery_config.stretches if @sorcery_config.encryption_provider.respond_to?(:stretches) && @sorcery_config.stretches
@sorcery_config.encryption_provider.join_token = @sorcery_config.salt_join_token if @sorcery_config.encryption_provider.respond_to?(:join_token) && @sorcery_config.salt_join_token
end

def add_config_inheritance
self.class_eval do
def self.inherited(subclass)
Expand Down Expand Up @@ -148,7 +148,7 @@ def external?

# Calls the configured encryption provider to compare the supplied password with the encrypted one.
def valid_password?(pass)
_crypted = self.send(sorcery_config.crypted_password_attribute_name)
_crypted = self.send(sorcery_config.crypted_password_attribute_name)
return _crypted == pass if sorcery_config.encryption_provider.nil?

_salt = self.send(sorcery_config.salt_attribute_name) unless sorcery_config.salt_attribute_name.nil?
Expand Down