Merge pull request #10061 from annando/issue-10050-again

Issue 10050: Ensure to not create contacts for expired users
2022.09-rc
Hypolite Petovan 2021-03-20 11:56:18 -04:00 zatwierdzone przez GitHub
commit fd1ae3f1fb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 7 dodań i 3 usunięć

Wyświetl plik

@ -571,7 +571,8 @@ class Contact
return true; return true;
} }
$user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'pubkey', 'prvkey'], ['uid' => $uid]); $user = DBA::selectFirst('user', ['uid', 'username', 'nickname', 'pubkey', 'prvkey'],
['uid' => $uid, 'account_expired' => false]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
return false; return false;
} }
@ -624,7 +625,7 @@ class Contact
} }
$fields = ['nickname', 'page-flags', 'account-type', 'prvkey', 'pubkey']; $fields = ['nickname', 'page-flags', 'account-type', 'prvkey', 'pubkey'];
$user = DBA::selectFirst('user', $fields, ['uid' => $uid]); $user = DBA::selectFirst('user', $fields, ['uid' => $uid, 'account_expired' => false]);
if (!DBA::isResult($user)) { if (!DBA::isResult($user)) {
return; return;
} }

Wyświetl plik

@ -399,7 +399,7 @@ class User
return false; return false;
} }
if (!$repairMissing) { if (!$repairMissing || $owner['account_expired']) {
return $owner; return $owner;
} }
@ -1367,6 +1367,9 @@ class User
// unique), so it cannot be re-registered in the future. // unique), so it cannot be re-registered in the future.
DBA::insert('userd', ['username' => $user['nickname']]); DBA::insert('userd', ['username' => $user['nickname']]);
// Remove all personal settings, especially connector settings
DBA::delete('pconfig', ['uid' => $uid]);
// The user and related data will be deleted in Friendica\Worker\ExpireAndRemoveUsers // The user and related data will be deleted in Friendica\Worker\ExpireAndRemoveUsers
DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]); DBA::update('user', ['account_removed' => true, 'account_expires_on' => DateTimeFormat::utc('now + 7 day')], ['uid' => $uid]);
Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid); Worker::add(PRIORITY_HIGH, 'Notifier', Delivery::REMOVAL, $uid);