diff --git a/config/Migrations/20240801112143_ChangeAvatarColumnTypeInSocialAccounts.php b/config/Migrations/20240801112143_ChangeAvatarColumnTypeInSocialAccounts.php new file mode 100644 index 00000000..0fb638b8 --- /dev/null +++ b/config/Migrations/20240801112143_ChangeAvatarColumnTypeInSocialAccounts.php @@ -0,0 +1,24 @@ +table('social_accounts'); + $table->changeColumn('avatar', 'text', [ + 'default' => null, + 'null' => true, + ]); + $table->update(); + } +} diff --git a/src/Model/Behavior/SocialBehavior.php b/src/Model/Behavior/SocialBehavior.php index 78fe8d83..36c0fb4c 100644 --- a/src/Model/Behavior/SocialBehavior.php +++ b/src/Model/Behavior/SocialBehavior.php @@ -281,8 +281,13 @@ public function generateUniqueUsername($username) */ public function findExistingForSocialLogin(\Cake\ORM\Query\SelectQuery $query, array $options) { + $email = $options['email'] ?? null; + if (!$email) { + return $query->where('1 != 1'); + } + return $query->where([ - $this->_table->aliasField('email') => $options['email'], + $this->_table->aliasField('email') => $email, ]); }