Implement tests

This commit is contained in:
Dennis Eichhorn 2018-12-16 11:25:35 +01:00
parent a62a8d3507
commit 56eded102a

View File

@ -370,16 +370,12 @@ final class ApiController extends Controller
if (((string) ($request->getData('password') ?? '')) !== '' if (((string) ($request->getData('password') ?? '')) !== ''
&& ((string) ($request->getData('login') ?? '')) !== '' && ((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); $this->updateModel($request, $account, $account, function() use($account) {
$account->setLoginTries((int) $this->app->appSettings->get(Settings::LOGIN_TRIES)); $account->setLoginTries((int) $this->app->appSettings->get(Settings::LOGIN_TRIES));
AccountMapper::update($account); AccountMapper::update($account);
$this->app->eventManager->trigger('POST:Module:Admin-account-update', '', [ }, 'account');
$request->getHeader()->getAccount(),
null,
$account,
]);
} }
} }
@ -404,8 +400,6 @@ final class ApiController extends Controller
$account->setEmail((string) ($request->getData('email') ?? '')); $account->setEmail((string) ($request->getData('email') ?? ''));
$account->generatePassword((string) ($request->getData('password') ?? '')); $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; return $account;
} }