mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-09 05:24:58 +09:00
Remove ClientPasswordResetTable and inline cleanup (#3453)
This commit is contained in:
1 parent
b4b984509d
commit
4cb7198006
2 files changed
+4
-52
No files matched your search
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Copyright 2022-2025 FOSSBilling
|
||||
* Copyright 2011-2021 BoxBilling, Inc.
|
||||
* SPDX-License-Identifier: Apache-2.0.
|
||||
*
|
||||
* @copyright FOSSBilling (https://www.fossbilling.org)
|
||||
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache-2.0
|
||||
*/
|
||||
class Model_ClientPasswordResetTable implements FOSSBilling\InjectionAwareInterface
|
||||
{
|
||||
protected ?Pimple\Container $di = null;
|
||||
|
||||
public function setDi(Pimple\Container $di): void
|
||||
{
|
||||
$this->di = $di;
|
||||
}
|
||||
|
||||
public function getDi(): ?Pimple\Container
|
||||
{
|
||||
return $this->di;
|
||||
}
|
||||
|
||||
public function generate(Model_Client $client, $ip)
|
||||
{
|
||||
$r = $this->di['db']->findOne('ClientPasswordReset', 'client_id', $client->id);
|
||||
if (!$r instanceof Model_ClientPasswordReset) {
|
||||
$r = $this->di['db']->dispense('ClientPasswordReset');
|
||||
$r->created_at = date('Y-m-d H:i:s');
|
||||
$r->client_id = $client->id;
|
||||
}
|
||||
|
||||
$r->ip = $ip;
|
||||
$r->hash = hash('sha256', random_int(50, random_int(10, 99)));
|
||||
$r->updated_at = date('Y-m-d H:i:s');
|
||||
$this->di['db']->store($r);
|
||||
|
||||
return $r;
|
||||
}
|
||||
|
||||
public function rmByClient(Model_Client $client): void
|
||||
{
|
||||
$models = $this->di['db']->find('ClientPasswordReset', 'client_id = ?', [$client->id]);
|
||||
foreach ($models as $model) {
|
||||
$this->di['db']->trash($model);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -663,8 +663,10 @@ class Service implements InjectionAwareInterface
|
||||
$service = $this->di['mod_service']('Activity');
|
||||
$service->rmByClient($model);
|
||||
|
||||
$table = $this->di['table']('ClientPasswordReset');
|
||||
$table->rmByClient($model);
|
||||
$resetRecords = $this->di['db']->find('ClientPasswordReset', 'client_id = ?', [$model->id]);
|
||||
foreach ($resetRecords as $resetRecord) {
|
||||
$this->di['db']->trash($resetRecord);
|
||||
}
|
||||
|
||||
$query = $this->di['dbal']->createQueryBuilder();
|
||||
$query
|
||||
|
||||
Reference in new issue
Block a user