private function validateForm()
{
// is the form submitted
if ($this->frm->isSubmitted()) {
// get fields
$txtPassword = $this->frm->getField('password');
// field is filled in?
$txtPassword->isFilled(FL::getError('PasswordIsRequired'));
// valid
if ($this->frm->isCorrect()) {
// get profile id
$profileId = FrontendProfilesModel::getIdBySetting('forgot_password_key', $this->URL->getParameter(0));
// remove key (we can only update the password once with this key)
FrontendProfilesModel::deleteSetting($profileId, 'forgot_password_key');
// update password
FrontendProfilesAuthentication::updatePassword($profileId, $txtPassword->getValue());
// login (check again because we might have logged in in the meanwhile)
if (!FrontendProfilesAuthentication::isLoggedIn()) {
FrontendProfilesAuthentication::login($profileId);
}
// trigger event
FrontendModel::triggerEvent('Profiles', 'after_reset_password', array('id' => $profileId));
// redirect
$this->redirect(FrontendNavigation::getURLForBlock('Profiles', 'ResetPassword') . '/' . $this->URL->getParameter(0) . '?sent=true');
} else {
$this->tpl->assign('forgotPasswordHasError', true);
}
}
}