mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-18 12:54:27 +01:00
[bug] fix duplicates email on case sensitive matches
This commit is contained in:
parent
90b1e98938
commit
9173bdbcb4
@ -79,17 +79,17 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
|
||||
def username_exists?(username, exclude_id = nil)
|
||||
if exclude_id.nil?
|
||||
User.where(username: username).size.positive?
|
||||
User.where('lower(username) = ?', username.downcase).size.positive?
|
||||
else
|
||||
User.where(username: username).where.not(id: exclude_id).size.positive?
|
||||
User.where('lower(username) = ?', username.downcase).where.not(id: exclude_id).size.positive?
|
||||
end
|
||||
end
|
||||
|
||||
def email_exists?(email, exclude_id = nil)
|
||||
if exclude_id.nil?
|
||||
User.where(email: email).size.positive?
|
||||
User.where('lower(email) = ?', email.downcase).size.positive?
|
||||
else
|
||||
User.where(email: email).where.not(id: exclude_id).size.positive?
|
||||
User.where('lower(email) = ?', email.downcase).where.not(id: exclude_id).size.positive?
|
||||
end
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user