1
0
Fork 0

lost password verification mail via notification()

This commit is contained in:
fabrixxm 2014-09-07 10:27:39 +02:00
commit d85bdd8fb0
29 changed files with 65 additions and 887 deletions

View file

@ -1,6 +1,7 @@
<?php
require_once('include/email.php');
require_once('include/enotify.php');
function lostpass_post(&$a) {
@ -32,23 +33,47 @@ function lostpass_post(&$a) {
if($r)
info( t('Password reset request issued. Check your email.') . EOL);
$email_tpl = get_intltext_template("lostpass_eml.tpl");
$email_tpl = replace_macros($email_tpl, array(
'$sitename' => $a->config['sitename'],
'$siteurl' => $a->get_baseurl(),
'$username' => $username,
'$email' => $email,
'$reset_link' => $a->get_baseurl() . '/lostpass?verify=' . $new_password
));
$res = mail($email, email_header_encode(sprintf( t('Password reset requested at %s'),$a->config['sitename']),'UTF-8'),
$email_tpl,
'From: ' . 'Administrator' . '@' . $_SERVER['SERVER_NAME'] . "\n"
. 'Content-type: text/plain; charset=UTF-8' . "\n"
. 'Content-transfer-encoding: 8bit' );
$sitename = $a->config['sitename'];
$siteurl = $a->get_baseurl();
$resetlink = $a->get_baseurl() . '/lostpass?verify=' . $new_password;
$preamble = t('Dear %1$s,
A request was recently received at "%2$s" to reset your account
password. In order to confirm this request, please select the verification link
below or paste it into your web browser address bar.
If you did NOT request this change, please DO NOT follow the link
provided and ignore and/or delete this email.
Your password will not be changed unless we can verify that you
issued this request.');
$body = t('Follow this link to verify your identity:
%1$s
You will then receive a follow-up message containing the new password.
You may change that password from your account settings page after logging in.
The login details are as follows:
Site Location: %2$s
Login Name: %3$s');
$preamble = sprintf($preamble, $username, $sitename);
$body = sprintf($body, $resetlink, $siteurl, $email);
notification(array(
'type' => "SYSTEM_EMAIL",
'to_email' => $email,
'subject'=> sprintf( t('Password reset requested at %s'),$sitename),
'preamble'=> $preamble,
'body' => $body));
goaway(z_root());
}
@ -113,7 +138,7 @@ function lostpass_content(&$a) {
return $o;
}
}
else {
$tpl = get_markup_template('lostpass.tpl');
@ -122,7 +147,7 @@ function lostpass_content(&$a) {
'$title' => t('Forgot your Password?'),
'$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'),
'$name' => t('Nickname or Email: '),
'$submit' => t('Reset')
'$submit' => t('Reset')
));
return $o;