Feat: User deletion confirmation
This commit is contained in:
@@ -5,6 +5,8 @@ namespace App\Livewire\Team;
|
||||
use App\Models\Team;
|
||||
use App\Models\User;
|
||||
use Livewire\Component;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdminView extends Component
|
||||
{
|
||||
@@ -73,8 +75,12 @@ class AdminView extends Component
|
||||
$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()) {
|
||||
return $this->dispatch('error', 'You are not authorized to delete users');
|
||||
}
|
||||
|
||||
@@ -24,9 +24,18 @@
|
||||
<div class="w-[500px]">
|
||||
<x-forms.input readonly label="Deploy Webhook URL" id="webhook" />
|
||||
</div>
|
||||
<x-modal-confirmation isHighlighted buttonTitle="Redeploy All" action="redeploy_all">
|
||||
All resources will be redeployed.
|
||||
</x-modal-confirmation>
|
||||
<x-modal-confirmation
|
||||
title="Redeploy all resources with this tag?"
|
||||
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 class="grid grid-cols-1 gap-2 pt-4 lg:grid-cols-2 xl:grid-cols-3">
|
||||
@foreach ($applications as $application)
|
||||
|
||||
@@ -16,21 +16,16 @@
|
||||
<div class="flex-1"></div>
|
||||
<div class="flex items-center justify-center gap-2 mx-4 text-xs font-bold ">
|
||||
<x-modal-confirmation
|
||||
title="Confirm User Deletion?"
|
||||
buttonTitle="Delete User"
|
||||
title="Confirm User Deletion?"
|
||||
buttonTitle="Delete"
|
||||
isErrorButton
|
||||
:actions="['This will delete the user and all the ressources related to this user from Coolify and the database.']"
|
||||
confirmText="{{ $user->name }}"
|
||||
submitAction="delete({{ $user->id }})"
|
||||
: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"
|
||||
shortConfirmationLabel="User Name"
|
||||
submitAction="delete({{ $user->id }})">
|
||||
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>
|
||||
step3ButtonText="Permanently Delete User"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@empty
|
||||
|
||||
Reference in New Issue
Block a user