1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-02-20 14:54:15 +01:00

(bug) error if no username/email was provided by the sso

This commit is contained in:
Sylvain 2022-01-17 12:42:27 +01:00
parent 9173bdbcb4
commit 0cffa68919

View File

@ -79,17 +79,17 @@ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
def username_exists?(username, exclude_id = nil)
if exclude_id.nil?
User.where('lower(username) = ?', username.downcase).size.positive?
User.where('lower(username) = ?', username&.downcase).size.positive?
else
User.where('lower(username) = ?', username.downcase).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('lower(email) = ?', email.downcase).size.positive?
User.where('lower(email) = ?', email&.downcase).size.positive?
else
User.where('lower(email) = ?', email.downcase).where.not(id: exclude_id).size.positive?
User.where('lower(email) = ?', email&.downcase).where.not(id: exclude_id).size.positive?
end
end