Limit it to 20 credential for preformance reasons

This commit is contained in:
brantje 2016-10-15 22:35:29 +02:00
parent 11f427904c
commit 3524cded0d
No known key found for this signature in database
GPG key ID: 5FF1D117F918687F

View file

@ -39,7 +39,7 @@ class CredentialMapper extends Mapper {
*/
public function getRandomCredentialByVaultId($vault_id, $user_id) {
$sql = 'SELECT * FROM `*PREFIX*passman_credentials` ' .
'WHERE `user_id` = ? and vault_id = ? AND shared_key is NULL';
'WHERE `user_id` = ? and vault_id = ? AND shared_key is NULL LIMIT 20';
$entities = $this->findEntities($sql, [$user_id, $vault_id]);
$count = count($entities);
$entities = array_splice($entities, rand(0, $count), 1);