checkPasswordRecoveryCode($username, $code)) { return ['success' => false, 'errors' => [Config::lang('pPassword_code_text_error')]]; } if ($totppf->usesTOTP($username) && !$totppf->checkUserTOTP($username, $totpCode)) { return ['success' => false, 'errors' => [Config::lang('pTotp_failed')]]; } if (!$handler->init($username)) { return ['success' => false, 'errors' => $handler->errormsg]; } $values = ['password' => $password, 'password2' => $password2]; if (!($handler->set($values) && $handler->save())) { return ['success' => false, 'errors' => $handler->errormsg]; } $handler->wipePasswordRecoveryCode($username); // $handler->errormsg will most likely be an empty array return ['success' => true, 'errors' => $handler->errormsg]; } }