userPassword = $userPassword; $this->dbi = $dbi; } public function __invoke(ServerRequest $request): void { $GLOBALS['hostname'] ??= null; $GLOBALS['username'] ??= null; $GLOBALS['change_password_message'] ??= null; $GLOBALS['msg'] ??= null; $this->addScriptFiles(['server/privileges.js', 'vendor/zxcvbn-ts.js']); /** * Displays an error message and exits if the user isn't allowed to use this * script */ if (! $GLOBALS['cfg']['ShowChgPassword']) { $GLOBALS['cfg']['ShowChgPassword'] = $this->dbi->selectDb('mysql'); } if ($GLOBALS['cfg']['Server']['auth_type'] === 'config' || ! $GLOBALS['cfg']['ShowChgPassword']) { $this->response->addHTML(Message::error( __('You don\'t have sufficient privileges to be here right now!') )->getDisplay()); return; } $noPass = $request->getParsedBodyParam('nopass'); $pmaPw = $request->getParsedBodyParam('pma_pw'); $pmaPw2 = $request->getParsedBodyParam('pma_pw2'); /** * If the "change password" form has been submitted, checks for valid values * and submit the query or logout */ if ($noPass !== null) { if ($noPass == '1') { $password = ''; } else { $password = $pmaPw; } $GLOBALS['change_password_message'] = $this->userPassword->setChangePasswordMsg( $pmaPw, $pmaPw2, (bool) $noPass ); $GLOBALS['msg'] = $GLOBALS['change_password_message']['msg']; if (! $GLOBALS['change_password_message']['error']) { $sql_query = $this->userPassword->changePassword( $password, $request->getParsedBodyParam('authentication_plugin') ); if ($this->response->isAjax()) { $sql_query = Generator::getMessage( $GLOBALS['change_password_message']['msg'], $sql_query, 'success' ); $this->response->addJSON('message', $sql_query); return; } $this->response->addHTML('