From 56eded102a0a6ce41b1101b316d9c0209af87aaa Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Sun, 16 Dec 2018 11:25:35 +0100 Subject: [PATCH] Implement tests --- Controller/ApiController.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/Controller/ApiController.php b/Controller/ApiController.php index 2559698..022a817 100644 --- a/Controller/ApiController.php +++ b/Controller/ApiController.php @@ -370,16 +370,12 @@ final class ApiController extends Controller if (((string) ($request->getData('password') ?? '')) !== '' && ((string) ($request->getData('login') ?? '')) !== '' ) { - $this->app->moduleManager->get('Profile')->apiProfileCreateDbEntry(new \Modules\Profile\Models\Profile($account)); + $this->app->moduleManager->get('Profile')->apiProfileCreateDbEntry(new \Modules\Profile\Models\Profile($account), $request); - $this->app->eventManager->trigger('PRE:Module:Admin-account-update', '', $account); - $account->setLoginTries((int) $this->app->appSettings->get(Settings::LOGIN_TRIES)); - AccountMapper::update($account); - $this->app->eventManager->trigger('POST:Module:Admin-account-update', '', [ - $request->getHeader()->getAccount(), - null, - $account, - ]); + $this->updateModel($request, $account, $account, function() use($account) { + $account->setLoginTries((int) $this->app->appSettings->get(Settings::LOGIN_TRIES)); + AccountMapper::update($account); + }, 'account'); } } @@ -404,8 +400,6 @@ final class ApiController extends Controller $account->setEmail((string) ($request->getData('email') ?? '')); $account->generatePassword((string) ($request->getData('password') ?? '')); - // todo: set remaining login tries based on global default config here. but before you have to add it to the model and mapper - return $account; }