Unsuspend a backend user from user update screen (#5032)
This commit is contained in:
parent
9155e7de7e
commit
439ed2cc33
|
|
@ -148,6 +148,20 @@ class Users extends Controller
|
|||
return Backend::redirect('backend/users/myaccount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Unsuspend this user
|
||||
*/
|
||||
public function update_onUnsuspendUser($recordId)
|
||||
{
|
||||
$model = $this->formFindModelObject($recordId);
|
||||
|
||||
$model->unsuspend();
|
||||
|
||||
Flash::success(Lang::get('backend::lang.account.unsuspend_success'));
|
||||
|
||||
return Redirect::refresh();
|
||||
}
|
||||
|
||||
/**
|
||||
* My Settings controller
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
<?php if ($formModel->isSuspended()): ?>
|
||||
<div class="loading-indicator-container">
|
||||
<button
|
||||
type="button"
|
||||
data-request="onUnsuspendUser"
|
||||
data-load-indicator="<?= e(trans('backend::lang.account.unsuspend_working')) ?>"
|
||||
data-request-confirm="<?= e(trans('backend::lang.account.unsuspend_confirm')) ?>"
|
||||
class="btn btn-danger oc-icon-unlock-alt"
|
||||
style="width: 100%; text-align: center"
|
||||
>
|
||||
<?= e(trans('backend::lang.account.unsuspend')) ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
|
|
@ -48,6 +48,10 @@ return [
|
|||
'impersonate_working' => 'Impersonating...',
|
||||
'impersonating' => 'Impersonating :full_name',
|
||||
'stop_impersonating' => 'Stop impersonating',
|
||||
'unsuspend' => 'Unsuspend',
|
||||
'unsuspend_confirm' => 'Are you sure you want to unsuspend this user?',
|
||||
'unsuspend_success' => 'User has been unsuspended.',
|
||||
'unsuspend_working' => 'Unsuspending...',
|
||||
'signed_in_as' => 'Signed in as :full_name',
|
||||
'sign_out' => 'Sign out',
|
||||
'login' => 'Login',
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
use Mail;
|
||||
use Event;
|
||||
use Backend;
|
||||
use BackendAuth;
|
||||
use October\Rain\Auth\Models\User as UserBase;
|
||||
|
||||
/**
|
||||
|
|
@ -190,4 +191,22 @@ class User extends UserBase
|
|||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user is suspended.
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuspended()
|
||||
{
|
||||
return BackendAuth::findThrottleByUserId($this->id)->checkSuspended();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the suspension on this user.
|
||||
* @return void
|
||||
*/
|
||||
public function unsuspend()
|
||||
{
|
||||
BackendAuth::findThrottleByUserId($this->id)->unsuspend();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,6 +71,10 @@ secondaryTabs:
|
|||
label: ''
|
||||
context: [update]
|
||||
type: partial
|
||||
btn_unsuspend:
|
||||
label: ''
|
||||
context: [update]
|
||||
type: partial
|
||||
avatar:
|
||||
label: backend::lang.user.avatar
|
||||
type: fileupload
|
||||
|
|
|
|||
Loading…
Reference in New Issue