Beispiel #1
0
 public function lostPassword($username)
 {
     // <editor-fold defaultstate="collapsed" desc="Aspect:jP">
     try {
         $MArgs = func_get_args();
         return Aspect::joinPoint("around", $this, __METHOD__, $MArgs);
     } catch (AOPNoAdviceException $e) {
     }
     Aspect::joinPoint("before", $this, __METHOD__, $MArgs);
     // </editor-fold>
     if ($username == "") {
         Red::errorC("User", "lostPasswordErrorUser");
     }
     $Lang = $this->loadLanguageClass("User")->getText();
     $ac = new anyC();
     $ac->setCollectionOf("User");
     $ac->addAssocV3("username", "=", $username);
     $ac->lCV3();
     $U = $ac->getNextEntry();
     if ($U == null) {
         try {
             $AL = new mphynxAltLogin();
             $AL->addAssocV3("username", "=", $username);
             $U = $AL->getNextEntry();
         } catch (Exception $e) {
             Red::errorC("User", "lostPasswordErrorUser");
         }
     }
     if ($U == null) {
         Red::errorC("User", "lostPasswordErrorUser");
     }
     $Admin = new anyC();
     $Admin->setCollectionOf("User");
     $Admin->addAssocV3("isAdmin", "=", "1");
     $Admin = $Admin->getNextEntry();
     if ($Admin == null) {
         Red::errorC("User", "lostPasswordErrorAdmin");
     }
     if ($Admin->A("UserEmail") == "") {
         Red::errorC("User", "lostPasswordErrorAdmin");
     }
     $mail = new htmlMimeMail5();
     $mail->setFrom("phynx@" . $_SERVER["HTTP_HOST"]);
     $mail->setSubject("[phynx] Password recovery for user {$username}");
     $mail->setText(wordwrap("Dear " . $Admin->A("name") . ",\n\nyou received this email because the user '{$username}' of the phynx framework at {$_SERVER['HTTP_HOST']} has lost his password and is requesting a new one.\n\nBest regards\n\tphynx", 80));
     if (!$mail->send(array($Admin->A("UserEmail")))) {
         Red::errorC("User", "lostPasswordErrorAdmin");
     }
     Red::alertC("User", "lostPasswordOK");
 }