Feat: User deletion confirmation
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Livewire\Team;
|
|||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
|
|
||||||
class AdminView extends Component
|
class AdminView extends Component
|
||||||
{
|
{
|
||||||
@@ -73,8 +75,12 @@ class AdminView extends Component
|
|||||||
$team->delete();
|
$team->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete($id)
|
public function delete($id, $password)
|
||||||
{
|
{
|
||||||
|
if (!Hash::check($password, Auth::user()->password)) {
|
||||||
|
$this->addError('password', 'The provided password is incorrect.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (! auth()->user()->isInstanceAdmin()) {
|
if (! auth()->user()->isInstanceAdmin()) {
|
||||||
return $this->dispatch('error', 'You are not authorized to delete users');
|
return $this->dispatch('error', 'You are not authorized to delete users');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,9 +24,18 @@
|
|||||||
<div class="w-[500px]">
|
<div class="w-[500px]">
|
||||||
<x-forms.input readonly label="Deploy Webhook URL" id="webhook" />
|
<x-forms.input readonly label="Deploy Webhook URL" id="webhook" />
|
||||||
</div>
|
</div>
|
||||||
<x-modal-confirmation isHighlighted buttonTitle="Redeploy All" action="redeploy_all">
|
<x-modal-confirmation
|
||||||
All resources will be redeployed.
|
title="Redeploy all resources with this tag?"
|
||||||
</x-modal-confirmation>
|
isHighlighted
|
||||||
|
buttonTitle="Redeploy All"
|
||||||
|
submitAction="redeploy_all"
|
||||||
|
:actions="['All resources with this tag will be redeployed.', 'During redeploy resources will be temporarily unavailable.']"
|
||||||
|
confirmationText="{{ $oneTag->name }}"
|
||||||
|
confirmationLabel="Please confirm the execution of the actions by entering the Tag Name below"
|
||||||
|
shortConfirmationLabel="Tag Name"
|
||||||
|
:confirmWithPassword="false"
|
||||||
|
step2ButtonText="Redeploy All"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-1 gap-2 pt-4 lg:grid-cols-2 xl:grid-cols-3">
|
<div class="grid grid-cols-1 gap-2 pt-4 lg:grid-cols-2 xl:grid-cols-3">
|
||||||
@foreach ($applications as $application)
|
@foreach ($applications as $application)
|
||||||
|
|||||||
@@ -17,20 +17,15 @@
|
|||||||
<div class="flex items-center justify-center gap-2 mx-4 text-xs font-bold ">
|
<div class="flex items-center justify-center gap-2 mx-4 text-xs font-bold ">
|
||||||
<x-modal-confirmation
|
<x-modal-confirmation
|
||||||
title="Confirm User Deletion?"
|
title="Confirm User Deletion?"
|
||||||
buttonTitle="Delete User"
|
buttonTitle="Delete"
|
||||||
isErrorButton
|
isErrorButton
|
||||||
:actions="['This will delete the user and all the ressources related to this user from Coolify and the database.']"
|
submitAction="delete({{ $user->id }})"
|
||||||
confirmText="{{ $user->name }}"
|
:actions="['The selected user will be permanently deleted from Coolify and the database.', 'All resources (application, databases, services, configurations, servers, private keys, tags, etc.) related to this user will be deleted from Coolify and from the server (if the server is reachable).']"
|
||||||
|
confirmationText="{{ $user->name }}"
|
||||||
confirmationLabel="Please confirm the execution of the actions by entering the User Name below"
|
confirmationLabel="Please confirm the execution of the actions by entering the User Name below"
|
||||||
shortConfirmationLabel="User Name"
|
shortConfirmationLabel="User Name"
|
||||||
submitAction="delete({{ $user->id }})">
|
step3ButtonText="Permanently Delete User"
|
||||||
This will delete all resources (application, databases, services, configurations, servers,
|
/>
|
||||||
private keys, tags, etc.) from Coolify and <span
|
|
||||||
class="font-bold text-red-500 dark:text-warning">from the server (if it's reachable)</span>.
|
|
||||||
<br> <br>
|
|
||||||
It is not reversible. <br><br>
|
|
||||||
<div class="font-bold text-red-500 dark:text-white">Think twice!</div>
|
|
||||||
</x-modal-confirmation>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@empty
|
@empty
|
||||||
|
|||||||
Reference in New Issue
Block a user