fixed case of no longer existing user

This commit is contained in:
Sascha Nitsch 2024-07-22 14:38:28 +02:00
parent 63532c54ea
commit 47f82afcb5

View file

@ -32,7 +32,8 @@ class User
openssl_pkey_export($private_key, $private);
try {
$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);
if ($stmt === false) {
throw new \Federator\Exceptions\ServerError();
@ -119,8 +120,7 @@ class User
}
}
if ($cache !== null) {
print_r($user);
if ($user->id === null) {
if ($user->id === null && $user->externalid !== null) {
self::addLocalUser($dbh, $user, $_name);
}
$cache->saveRemoteUserByName($_name, $user);