userPassword = $userPassword; $this->dbi = $dbi; } public function __invoke(ServerRequest $request): void { $GLOBALS['hostname'] = $GLOBALS['hostname'] ?? null; $GLOBALS['username'] = $GLOBALS['username'] ?? null; $GLOBALS['password'] = $GLOBALS['password'] ?? null; $GLOBALS['change_password_message'] = $GLOBALS['change_password_message'] ?? null; $GLOBALS['msg'] = $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'); /** * If the "change password" form has been submitted, checks for valid values * and submit the query or logout */ if ($noPass !== null) { if ($noPass == '1') { $GLOBALS['password'] = ''; } else { $GLOBALS['password'] = $pmaPw; } $GLOBALS['change_password_message'] = $this->userPassword->setChangePasswordMsg( $_POST['pma_pw'], $_POST['pma_pw2'], (bool) $_POST['nopass'] ); $GLOBALS['msg'] = $GLOBALS['change_password_message']['msg']; if (! $GLOBALS['change_password_message']['error']) { $sql_query = $this->userPassword->changePassword( $GLOBALS['password'], $_POST['authentication_plugin'] ?? null ); 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('