[Updated: resolved admin user delete issue.]
This commit is contained in:
parent
bd5659487f
commit
20b7d78359
|
|
@ -408,9 +408,13 @@ Route::group(['middleware' => ['web']], function () {
|
|||
//delete backend user
|
||||
Route::post('/users/delete/{id}', 'Webkul\User\Http\Controllers\UserController@destroy')->name('admin.users.delete');
|
||||
|
||||
Route::post('/confirm/destroy', 'Webkul\User\Http\Controllers\UserController@destroySelf')->defaults('_config', [
|
||||
Route::get('/users/confirm/{id}', 'Webkul\User\Http\Controllers\UserController@confirm')->defaults('_config', [
|
||||
'view' => 'admin::customers.confirm-password'
|
||||
])->name('super.users.confirm');
|
||||
|
||||
Route::post('/users/confirm/{id}', 'Webkul\User\Http\Controllers\UserController@destroySelf')->defaults('_config', [
|
||||
'redirect' => 'admin.users.index'
|
||||
])->name('admin.users.confirm.destroy');
|
||||
])->name('admin.users.destroy');
|
||||
|
||||
// User Role Routes
|
||||
Route::get('/roles', 'Webkul\User\Http\Controllers\RoleController@index')->defaults('_config', [
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@
|
|||
<div class="content">
|
||||
<div class="page-header">
|
||||
<div class="page-title">
|
||||
<h1>{{ __('admin::app.users.users.confirm-delete-title') }}</h1>
|
||||
</div>
|
||||
<div class="page-action">
|
||||
|
||||
<h1>
|
||||
<i class="icon angle-left-icon back-link" onclick="history.length > 1 ? history.go(-1) : window.location = '{{ url('/admin/dashboard') }}';"></i>
|
||||
{{ __('admin::app.users.users.confirm-delete-title') }}
|
||||
</h1>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="page-content">
|
||||
<form action="{{ route('admin.users.confirm.destroy') }}" method="POST" @submit.prevent="onSubmit">
|
||||
<form action="{{ route('admin.users.destroy', $user->id) }}" method="POST" @submit.prevent="onSubmit">
|
||||
@csrf
|
||||
<div class="control-group" :class="[errors.has('password') ? 'has-error' : '']">
|
||||
<label for="password" class="required">
|
||||
|
|
|
|||
|
|
@ -685,6 +685,11 @@
|
|||
_method : element.getAttribute('data-method')
|
||||
}).then(function(response) {
|
||||
this.result = response;
|
||||
|
||||
if (response.data.redirect) {
|
||||
window.location.href = response.data.redirect;
|
||||
}
|
||||
|
||||
location.reload();
|
||||
}).catch(function (error) {
|
||||
location.reload();
|
||||
|
|
|
|||
|
|
@ -172,7 +172,9 @@ class UserController extends Controller
|
|||
Event::dispatch('user.admin.delete.before', $id);
|
||||
|
||||
if (auth()->guard('admin')->user()->id == $id) {
|
||||
return view('admin::customers.confirm-password');
|
||||
return response()->json([
|
||||
'redirect' => route('super.users.confirm', ['id' => $id]),
|
||||
]);
|
||||
}
|
||||
|
||||
try {
|
||||
|
|
@ -191,6 +193,19 @@ class UserController extends Controller
|
|||
return response()->json(['message' => false], 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for confirming the user password.
|
||||
*
|
||||
* @param integer $id
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function confirm($id)
|
||||
{
|
||||
$user = $this->adminRepository->findOrFail($id);
|
||||
|
||||
return view($this->_config['view'], compact('user'));
|
||||
}
|
||||
|
||||
/**
|
||||
* destroy current after confirming
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue