mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-20 11:47:53 +02:00
Trigger twofaccounts withdrawal after group deletion, not during
This commit is contained in:
parent
ceb9d69478
commit
b82a7eb604
@ -6,6 +6,7 @@ use App\Models\Group;
|
||||
use Illuminate\Broadcasting\InteractsWithSockets;
|
||||
use Illuminate\Foundation\Events\Dispatchable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class GroupDeleted
|
||||
{
|
||||
@ -24,5 +25,7 @@ class GroupDeleted
|
||||
public function __construct(Group $group)
|
||||
{
|
||||
$this->group = $group;
|
||||
|
||||
Log::info(sprintf('Group %s (id #%d) deleted ', var_export($group->name, true), $group->id));
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Listeners;
|
||||
|
||||
use App\Events\GroupDeleting;
|
||||
use App\Events\GroupDeleted;
|
||||
use App\Models\TwoFAccount;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
@ -23,7 +23,7 @@ class DissociateTwofaccountFromGroup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle(GroupDeleting $event)
|
||||
public function handle(GroupDeleted $event)
|
||||
{
|
||||
TwoFAccount::where('group_id', $event->group->id)
|
||||
->update(
|
||||
|
@ -98,9 +98,6 @@ class Group extends Model
|
||||
static::updated(function (object $model) {
|
||||
Log::info(sprintf('Group %s (id #%d) updated by user ID #%s', var_export($model->name, true), $model->id, $model->user_id));
|
||||
});
|
||||
static::deleted(function (object $model) {
|
||||
Log::info(sprintf('Group %s (id #%d) deleted ', var_export($model->name, true), $model->id));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,6 @@
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Events\GroupDeleted;
|
||||
use App\Events\GroupDeleting;
|
||||
use App\Events\ScanForNewReleaseCalled;
|
||||
use App\Events\StoreIconsInDatabaseSettingChanged;
|
||||
use App\Events\TwoFAccountDeleted;
|
||||
@ -44,10 +43,8 @@ class EventServiceProvider extends ServiceProvider
|
||||
TwoFAccountDeleted::class => [
|
||||
CleanIconStorage::class,
|
||||
],
|
||||
GroupDeleting::class => [
|
||||
DissociateTwofaccountFromGroup::class,
|
||||
],
|
||||
GroupDeleted::class => [
|
||||
DissociateTwofaccountFromGroup::class,
|
||||
ResetUsersPreference::class,
|
||||
],
|
||||
ScanForNewReleaseCalled::class => [
|
||||
|
Loading…
x
Reference in New Issue
Block a user