From d6a6b6bce0a2b7ca3db32d8a6403693d31c631b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Wed, 17 Jan 2024 09:39:09 +0000 Subject: [PATCH] Fix FLEXIAPI-133 Use the correct breadcrumb on create and fix a password... --- flexiapi/app/Account.php | 2 +- flexiapi/app/Http/Controllers/Admin/AccountController.php | 5 ++++- .../resources/views/admin/account/create_edit.blade.php | 8 ++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/flexiapi/app/Account.php b/flexiapi/app/Account.php index 82514f4..1fb54df 100644 --- a/flexiapi/app/Account.php +++ b/flexiapi/app/Account.php @@ -441,7 +441,7 @@ class Account extends Authenticatable return !empty($this->recovery_code) && $this->updated_at->greaterThan($oneHourAgo); } - public function updatePassword($newPassword, ?string $algorithm = null) + public function updatePassword(string $newPassword, ?string $algorithm = null) { $algorithm = $algorithm ?? config('app.account_default_password_algorithm'); diff --git a/flexiapi/app/Http/Controllers/Admin/AccountController.php b/flexiapi/app/Http/Controllers/Admin/AccountController.php index 80f1482..39f2371 100644 --- a/flexiapi/app/Http/Controllers/Admin/AccountController.php +++ b/flexiapi/app/Http/Controllers/Admin/AccountController.php @@ -136,7 +136,10 @@ class AccountController extends Controller $account->phone = $request->get('phone'); - $account->updatePassword($request->get('password')); + if ($request->get('password')) { + $account->updatePassword($request->get('password')); + } + $account->setRole($request->get('role')); Log::channel('events')->info('Web Admin: Account updated', ['id' => $account->identifier]); diff --git a/flexiapi/resources/views/admin/account/create_edit.blade.php b/flexiapi/resources/views/admin/account/create_edit.blade.php index d97544f..0428825 100644 --- a/flexiapi/resources/views/admin/account/create_edit.blade.php +++ b/flexiapi/resources/views/admin/account/create_edit.blade.php @@ -2,8 +2,12 @@ @section('breadcrumb') @include('admin.account.parts.breadcrumb_accounts_index') - @include('admin.account.parts.breadcrumb_accounts_edit', ['account' => $account]) - + @if ($account->id) + @include('admin.account.parts.breadcrumb_accounts_edit', ['account' => $account]) + + @else + + @endif @endsection @section('content')