fixed case of no longer existing user

develop
Sascha Nitsch 2024-07-22 14:38:28 +02:00
parent 63532c54ea
commit 47f82afcb5
1 changed files with 3 additions and 3 deletions

View File

@ -32,7 +32,8 @@ class User
openssl_pkey_export($private_key, $private); openssl_pkey_export($private_key, $private);
try { try {
$sql = 'insert into users (id, externalid, rsapublic, rsaprivate, validuntil)'; $sql = 'insert into users (id, externalid, rsapublic, rsaprivate, validuntil)';
$sql .= ' values (?, ?, ?, ?, now() + interval 1 day) on duplicate key update validuntil=now() + interval 1 day'; $sql .= ' values (?, ?, ?, ?, now() + interval 1 day)';
$sql .= ' on duplicate key update validuntil=now() + interval 1 day';
$stmt = $dbh->prepare($sql); $stmt = $dbh->prepare($sql);
if ($stmt === false) { if ($stmt === false) {
throw new \Federator\Exceptions\ServerError(); throw new \Federator\Exceptions\ServerError();
@ -119,8 +120,7 @@ class User
} }
} }
if ($cache !== null) { if ($cache !== null) {
print_r($user); if ($user->id === null && $user->externalid !== null) {
if ($user->id === null) {
self::addLocalUser($dbh, $user, $_name); self::addLocalUser($dbh, $user, $_name);
} }
$cache->saveRemoteUserByName($_name, $user); $cache->saveRemoteUserByName($_name, $user);