mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 10:28:13 +00:00
Fix some issues with admin self settings (#15332)
Don't require old password when not settings password Show old password field for user's own user
This commit is contained in:
parent
1bf68f73c4
commit
35406b4b32
@ -81,8 +81,8 @@ class UpdateUserRequest extends FormRequest
|
||||
// if not an admin and new_password is set, check old password matches
|
||||
$user = $this->route('user');
|
||||
if ($user && $this->user()->can('update', $user) && $this->user()->is($user)) {
|
||||
if ($this->has('new_password')) {
|
||||
if ($this->has('old_password')) {
|
||||
if ($this->get('new_password')) {
|
||||
if ($this->get('old_password')) {
|
||||
$user = $this->route('user');
|
||||
if ($user && ! Hash::check($this->old_password, $user->password)) {
|
||||
$validator->errors()->add('old_password', __('Existing password did not match'));
|
||||
|
@ -60,9 +60,9 @@
|
||||
<div class="form-group @if($errors->hasAny(['old_password', 'new_password', 'new_password_confirmation'])) has-error @endif">
|
||||
<label for="password" class="control-label col-sm-3">{{ __('Password') }}</label>
|
||||
<div class="col-sm-9">
|
||||
@cannot('admin')
|
||||
@if(auth()->user()->cannot('admin') || auth()->user()->is($user))
|
||||
<input type="password" class="form-control" id="old_password" name="old_password" placeholder="{{ __('Current Password') }}">
|
||||
@endcannot
|
||||
@endif
|
||||
<input type="password" autocomplete="off" class="form-control" id="new_password" name="new_password" placeholder="{{ __('New Password') }}">
|
||||
<input type="password" autocomplete="off" class="form-control" id="new_password_confirmation" name="new_password_confirmation" placeholder="{{ __('Confirm Password') }}">
|
||||
<span class="help-block">
|
||||
|
Loading…
Reference in New Issue
Block a user