From d4b30e036f430d6bc3facd882a9c9e7b58a111e1 Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 4 Apr 2021 17:10:52 +0200 Subject: [PATCH] many fixes and expands and module expansions --- Controller/ApiController.php | 10 +++++----- Models/ProfileMapper.php | 17 +++++++++++++---- .../AccountGroupSelector/base.tpl.php | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 0615ae1..10823da 100755 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -102,17 +102,17 @@ final class ApiController extends Controller * * @since 1.0.0 */ - public function apiProfileTempLoginCreate(Profile $profile, RequestAbstract $request) : void + public function apiProfileTempLoginCreate(Profile $profile, RequestAbstract $request, ResponseAbstract $response) : void { - $account = AccountMapper::get($reqeust->header->account); + $account = AccountMapper::get($request->header->account); $account->tempPassword = \password_hash(\random_bytes(64), \PASSWORD_DEFAULT); - $this->updateModel($request->header->account, $old, $profile, AccountMapper::class, 'profile', $request->getOrigin()); + $this->updateModel($request->header->account, $account, $account, AccountMapper::class, 'profile', $request->getOrigin()); $this->fillJsonResponse( $request, $response, - $status ? NotificationLevel::OK : NotificationLevel::WARNING, - 'Profil', + NotificationLevel::OK, + 'Profile', 'Temp password successfully created.', $account->tempPassword ); diff --git a/Models/ProfileMapper.php b/Models/ProfileMapper.php index 5fad31a..8ec6924 100755 --- a/Models/ProfileMapper.php +++ b/Models/ProfileMapper.php @@ -51,16 +51,25 @@ final class ProfileMapper extends DataMapperAbstract * @since 1.0.0 */ protected static array $ownsOne = [ - 'account' => [ - 'mapper' => AccountMapper::class, - 'external' => 'profile_account_account', - ], 'image' => [ 'mapper' => MediaMapper::class, 'external' => 'profile_account_image', ], ]; + /** + * Belongs to. + * + * @var array + * @since 1.0.0 + */ + protected static array $belongsTo = [ + 'account' => [ + 'mapper' => AccountMapper::class, + 'external' => 'profile_account_account', + ], + ]; + /** * Has many relation. * diff --git a/Theme/Backend/Components/AccountGroupSelector/base.tpl.php b/Theme/Backend/Components/AccountGroupSelector/base.tpl.php index bafdd53..9dbf9af 100755 --- a/Theme/Backend/Components/AccountGroupSelector/base.tpl.php +++ b/Theme/Backend/Components/AccountGroupSelector/base.tpl.php @@ -17,7 +17,7 @@ data-emptyAfter="true" data-autocomplete="off" data-src="api/admin/find/accgrp?search={!#igetId(); ?>}"> -