case 'submit': $page->smarty->assign('email', $_POST['email']); if ($_POST['email'] == "") { $page->smarty->assign('error', "Missing Email"); } else { // Check users exists and send an email. $ret = $page->users->getByEmail($_POST['email']); if (!$ret) { $page->smarty->assign('sent', "true"); break; } else { // Generate a forgottenpassword guid, store it in the user table. $guid = md5(uniqid()); $page->users->updatePassResetGuid($ret["id"], $guid); // Send the email $to = $ret["email"]; $subject = $page->settings->getSetting('title') . " Forgotten Password Request"; $contents = "Someone has requested a password reset for this email address.<br>To reset the password use <a href=\"" . $page->serverurl . "forgottenpassword?action=reset&guid={$guid}\">this link</a>\n"; $page->smarty->assign('sent', "true"); nzedb\utility\sendEmail($to, $subject, $contents, $page->settings->getSetting('email')); break; } } break; } $page->title = "Forgotten Password"; $page->meta_title = "Forgotten Password"; $page->meta_keywords = "forgotten,password,signup,registration"; $page->meta_description = "Forgotten Password"; $page->content = $page->smarty->fetch('forgottenpassword.tpl'); $page->render();
/** * Send a email for a invitation request. * * @param string $siteTitle Name of the admin's website. * @param string $siteEmail Email of the admin's website. * @param string $serverURL Address of the admin's website. * @param int $userID ID of the user sending the request. * @param string $emailTo Email of the person to send the request. * * @return string */ public function sendInvite($siteTitle, $siteEmail, $serverURL, $userID, $emailTo) { $sender = $this->getById($userID); $token = $this->hashSHA1(uniqid()); $subject = $siteTitle . " Invitation"; $url = $serverURL . "register?invitecode=" . $token; if (!is_null($sender['firstname']) || $sender['firstname'] != '') { $contents = $sender["firstname"] . " " . $sender["lastname"] . " has sent an invite to join " . $siteTitle . " to this email address.<br>To accept the invitation click <a href=\"{$url}\">this link</a>\n"; } else { $contents = $sender["username"] . " has sent an invite to join " . $siteTitle . " to this email address.<br>To accept the invitation click <a href=\"{$url}\">this link</a>\n"; } nzedb\utility\sendEmail($emailTo, $subject, $contents, $siteEmail); $this->addInvite($userID, $token); return $url; }