add email in reset password

This commit is contained in:
Andrey Kuvshinov
2020-08-29 12:50:57 +03:00
parent 6614bb6ebb
commit ff89fc80b4
5 changed files with 32 additions and 14 deletions

View File

@@ -31,7 +31,7 @@ define('API', 'http://api.argumenti.ru/');
define('IMGSRV', 'https://imgurl.argumenti.ru/'); define('IMGSRV', 'https://imgurl.argumenti.ru/');
/** отправка уведомлений */ /** отправка уведомлений */
set('mail', set('noreply',
[ [
'login' => 'noreply@argumenti.ru', 'login' => 'noreply@argumenti.ru',
'name' => 'Аргументы Недели', 'name' => 'Аргументы Недели',

View File

@@ -9,6 +9,7 @@ require 'routes/client.php';
require 'routes/anpdf.php'; require 'routes/anpdf.php';
require 'routes/auth.php'; require 'routes/auth.php';
require 'routes/pdfserver.php'; require 'routes/pdfserver.php';
require 'routes/email.php';
#api #api
require 'api/apiclient.php'; require 'api/apiclient.php';

View File

@@ -136,6 +136,19 @@ function reminder_kuri(){
$result = db_insert('resetpwd', $items, 'chitatel'); $result = db_insert('resetpwd', $items, 'chitatel');
$link = SITE.'resetpassword/'.$items['resethash']; $link = SITE.'resetpassword/'.$items['resethash'];
$mailconfig = set('noreply');
$mail['mail'] = $resetmail;
$mail['subject'] = 'КЛАН: создание пароля';
$mail['message'] = "
Вы запросили изменения пароля для Вашей учетной записи.\n
Для установления пароля пройдите по ссылке - $link.\n\n
- Не передавайте эту ссылку сторонним лицам\n
- Если Вы не запрашивали это действие просто проигнорируйте данное письмо\n\n
По вопросам обращайтесь на почту shop@argumenti.ru
";
sendmail($mailconfig, $mail);
$tempcontent = VIEWPATH.'reminder_end.phtml'; $tempcontent = VIEWPATH.'reminder_end.phtml';
include VIEWPATH.'layout_lite.phtml'; //центральный шаблон include VIEWPATH.'layout_lite.phtml'; //центральный шаблон

View File

@@ -7,25 +7,33 @@ function sendmail($config, $mail){
$send = new PHPMailer; $send = new PHPMailer;
$send->isSMTP(); $send->isSMTP();
//$send->SMTPDebug=3; // Set mailer to use SMTP $send->SMTPDebug=3; // Set mailer to use SMTP
$send->Host = $config['host']; // Specify main and backup SMTP servers $send->Host = $config['host']; // Specify main and backup SMTP servers
$send->Username = $config['login']; // SMTP username $send->Username = $config['login']; // SMTP username
$send->Password = $config['password']; $send->Password = $config['password'];
if (isset($frommail['secure'])) { if (isset($config['secure'])) {
$send->SMTPSecure = $frommail['secure']; $send->SMTPSecure = $config['secure'];
$send->SMTPAuth = true; $send->SMTPAuth = true;
} }
else { else {
$mail->SMTPSecure = false; $send->SMTPSecure = false;
$mail->SMTPAutoTLS = false; $send->SMTPAutoTLS = false;
} }
$send->Port = $config['port']; // TCP port to connect to $send->Port = $config['port']; // TCP port to connect to
$send->setFrom($config['mail'], $config['name']); $send->setFrom($config['login'], $config['name']);
$send->addAddress($mail, $mail); // Add a recipient $send->addAddress($mail['mail'], $mail['mail']); // Add a recipient
$send->CharSet = 'UTF-8'; $send->CharSet = 'UTF-8';
$send->isHTML(True); // Set email format to HTML
if (isset($mail['html'])){
$send->isHTML(True); // Set email format to HTML
}
else {
$send->ContentType = 'text/plain';
$send->isHTML(False);
}
$send->Subject = $mail['subject']; $send->Subject = $mail['subject'];
$send->Body = $mail['message']; $send->Body = $mail['message'];

View File

@@ -1,5 +1 @@
<h1>Ссылка на восстановление пароля выслана на Вашу электронную почту</h1> <h1>Ссылка на создание пароля выслана на Вашу электронную почту</h1>
<?if (isset($link)):?>
<div><a href="<?=$link?>">Для установки пароля пройдите по ссылке</a></div>
<?endif?>