public function post_forgot() { $u = new \ipinga\userTable('users'); $u->loadByEmail($_POST['email']); if ($u->saved === true) { $contents = array(); $contents['u'] = $u->id; $contents['t'] = \ipinga\log::$instanceName; $link = \ipinga\options::get('website_url') . '/password_reset/' . \ipinga\crypto::printableEncrypt($contents); // \services::sendEmail() only knows about token replacements from database and I didn't want to rewrite it $body = str_replace(':link:', $link, \ipinga\options::get('password_email_body')); \services::sendEmail(array($u->email), \ipinga\options::get('password_email_subject'), $body, $u); $this->template->show('password_link_on_the_way'); } else { // bad email address \ipinga\cookie::add('message_for_next_screen', 'Email address not found'); header('location: /login'); } }