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:
Tony Murray
2023-09-18 14:35:12 -05:00
committed by GitHub
parent 1bf68f73c4
commit 35406b4b32
2 changed files with 4 additions and 4 deletions

View File

@@ -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'));