fix: [AuthKeys] prevent race condition with double IPs

pull/8965/head
Christophe Vandeplas 2023-03-19 11:57:52 +01:00
parent 16a2713403
commit cb3b4b43dc
1 changed files with 3 additions and 0 deletions

View File

@ -190,6 +190,9 @@ class AuthKey extends AppModel
$possibleAuthkey['AuthKey']['unique_ips'][] = $remote_ip;
}
if ($update_db_ip) {
// prevent double entries due to race condition
$possibleAuthkey['AuthKey']['unique_ips'] = array_unique($possibleAuthkey['AuthKey']['unique_ips']);
// save in db
$this->save($possibleAuthkey);
}
// fetch user