From 7dd5ea42e9d398661ef44f9d4227d67f2fbcde61 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 19 Jun 2021 06:27:25 +0000 Subject: [PATCH] An empty user id does not have children --- src/Model/User.php | 4 ++++ src/Security/Authentication.php | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Model/User.php b/src/Model/User.php index f81b1ce764..14f40662b2 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -1505,6 +1505,10 @@ class User */ public static function identities($uid) { + if (empty($uid)) { + return []; + } + $identities = []; $user = DBA::selectFirst('user', ['uid', 'nickname', 'username', 'parent-uid'], ['uid' => $uid]); diff --git a/src/Security/Authentication.php b/src/Security/Authentication.php index 430ede13b4..ce101477e0 100644 --- a/src/Security/Authentication.php +++ b/src/Security/Authentication.php @@ -342,8 +342,10 @@ class Authentication $this->dba->update('user', ['login_date' => DateTimeFormat::utcNow()], ['uid' => $user_record['uid']]); // Set the login date for all identities of the user - $this->dba->update('user', ['login_date' => DateTimeFormat::utcNow()], - ['parent-uid' => $masterUid, 'account_removed' => false]); + if (!empty($masterUid)) { + $this->dba->update('user', ['login_date' => DateTimeFormat::utcNow()], + ['parent-uid' => $masterUid, 'account_removed' => false]); + } } if ($login_initial) {