$question = $u_prefs->getValue('security_question'); } else { $answer = $prefs->getValue('security_answer'); $question = $prefs->getValue('security_question'); } /* Set up the fields for the username and alternate email. */ $form->addHidden('', 'url', 'text', false); $form->addVariable(_("Username"), 'username', 'text', true); if (!empty($answer)) { if (!empty($question)) { $form->addVariable(_("Please respond to your security question: ") . $question, 'security_question', 'description', true); } $form->addVariable(_("Security answer"), 'security_answer', 'text', true); } else { $desc = _("The picture above is for antispam checking. Please retype the characters from the picture. They are case sensitive."); $form->addVariable(_("Human check"), 'captcha', 'captcha', true, false, $desc, array(Folks::getCAPTCHA(!$form->isSubmitted()), HORDE_BASE . '/config/couri.ttf')); } /* Validate the form. */ if ($form->validate()) { $form->getInfo(null, $info); /* Get user email. */ $email = Folks::getUserEmail($info['username']); if ($email instanceof PEAR_Error) { $notification->push($email); throw new Horde_Exception_AuthenticationFailure(); } /* Check the given values with the prefs stored ones. */ if (!empty($answer) && Horde_String::lower($answer) == Horde_String::lower($info['security_answer']) || empty($answer)) { /* Info matches, so reset the password. */ $password = $auth->resetPassword($info['username']); if ($password instanceof PEAR_Error) {