Example #1
0
     $adh = new Adherent($login_adh);
 }
 if ($adh->id != '') {
     //account has been found, proceed
     if (Core\GaletteMail::isValidEmail($adh->email)) {
         $password = new Core\Password();
         $res = $password->generateNewPassword($adh->id);
         if ($res == true) {
             $link_validity = new DateTime();
             $link_validity->add(new DateInterval('PT24H'));
             $df = _T("Y-m-d H:i:s");
             $proto = 'http';
             if (isset($_SERVER['HTTPS'])) {
                 $proto = 'https';
             }
             $texts = new Texts($texts_fields, $preferences, array('change_pass_uri' => $proto . '://' . $_SERVER['SERVER_NAME'] . dirname($_SERVER['REQUEST_URI']) . '/change_passwd.php?hash=' . urlencode($password->getHash()), 'link_validity' => $link_validity->format(_T("Y-m-d H:i:s")), 'login_adh' => custom_html_entity_decode($adh->login, ENT_QUOTES)));
             $mtxt = $texts->getTexts('pwd', $adh->language);
             $mail = new Core\GaletteMail();
             $mail->setSubject($texts->getSubject());
             $mail->setRecipients(array($adh->email => $adh->sname));
             $mail->setMessage($texts->getBody());
             $sent = $mail->send();
             if ($sent == Core\GaletteMail::MAIL_SENT) {
                 $hist->add(str_replace('%s', $login_adh, _T("Mail sent to '%s' for password recovery.")));
                 if ($from_admin === false) {
                     $success_detected[] = _T("A mail has been sent to your address.<br/>Please check your inbox and follow the instructions.");
                     $tpl->assign('success_detected', $success_detected);
                     $done = true;
                 } else {
                     $success_detected[] = _T("An mail has been sent to the member.");
                 }