Created
November 18, 2021 14:38
-
-
Save 0test/62e105cd3a2b6df9b73948f9ad76039f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MODX_API_MODE', true); | |
include_once("index.php"); | |
$modx->db->connect(); | |
if (empty ($modx->config)){ | |
$modx->getSettings(); | |
} | |
$modx->invokeEvent("OnWebPageInit"); | |
if(!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || (strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) != 'xmlhttprequest')){ | |
$modx->sendRedirect($modx->config['site_url']); | |
} | |
$webusers_table = $modx->getFullTableName('web_users'); | |
$webuser_attr_table = $modx->getFullTableName('web_user_attributes'); | |
$web_groups_table = $modx->getFullTableName('web_groups'); | |
$uid = $modx->getLoginUserID('web'); | |
$email = $modx->db->getValue($modx->db->select('setting_value', $modx->getFullTableName('system_settings'), "setting_name = 'client_emailto'")); | |
switch($_REQUEST['q']){ | |
case 'login': | |
$data = $modx->runSnippet('FormLister', | |
array( | |
'protectSubmit' => 0, | |
'submitLimit' => 0, | |
'formid' => 'login', | |
'controller' => 'Login', | |
'loginField' => 'email', | |
'rules' => '{ | |
"email":{ | |
"required":"Обязательно введите email", | |
"email":"Введите email правильно" | |
}, | |
"password":{ | |
"required":"Обязательно введите пароль" | |
} | |
}', | |
'formTpl' => 'login_form_tpl', | |
'messagesOuterTpl' => '@CODE:<div class="" role="alert">[+messages+]</div>', | |
'successTpl' => '@CODE: | |
<div class="text-center"> | |
Подождите, сейчас авторизируем... | |
<script> | |
$(document).ready(function(){ | |
setTimeout( | |
function() { | |
location.reload(); | |
}, 2000 | |
); | |
}); | |
</script> | |
</div> | |
', | |
'skipTpl' => '@CODE:<div class="text-center">Вы уже авторизованы.</div>', | |
'errorTpl' => '@CODE:<span class="text-danger">[+message+]</span>', | |
'errorClass' => ' has-error', | |
'requiredClass' => ' has-warning', | |
) | |
); | |
echo $data; | |
exit(); | |
break; | |
case 'register': | |
$data = $modx->runSnippet('FormLister', | |
array( | |
'protectSubmit' => 0, | |
'submitLimit' => 0, | |
'formid' => 'register', | |
'controller' => 'Register', | |
'userGroups' => 'Обычные покупатели', | |
'rules' => '{ | |
"email":{ | |
"required":"Введите email", | |
"email":"Неверный email" | |
}, | |
"password":{ | |
"required":"Введите пароль", | |
"minLength":{ | |
"params":6, | |
"message":"Больше 6 символов пожалуйста" | |
} | |
} | |
}', | |
'formTpl' => 'register_form_tpl', | |
'ccSenderField' => 'email', | |
'ccSenderTpl' => 'ccSenderTpl', | |
'ccSender' => '1', | |
'subject' => 'Регистрация на сайте "x"', | |
'messagesOuterTpl' => '@CODE:<div class="" role="alert">[+messages+]</div>', | |
'successTpl' => '@CODE: | |
<div>Поздравляем с успешной регистрацией</div> | |
<div class="bottom_links"> | |
<div class="modal-auth-auth"> | |
<a data-fancybox data-auth data-src="#lk_auth" href="javascript:;">Войти</a> | |
</div> | |
</div> | |
', | |
'errorTpl' => '@CODE:<span class="text-danger">[+message+]</span>', | |
'errorClass' => ' has-error', | |
'requiredClass' => ' has-warning', | |
'skipTpl' => '@CODE: <div class=" alert-info">Вы уже зарегистрированы, перейдите на страницу <a href="[~7977~]">авторизации</a></div>', | |
) | |
); | |
echo $data; | |
exit(); | |
break; | |
case 'password_restore': | |
$data = $modx->runSnippet('FormLister', | |
array( | |
'protectSubmit' => 0, | |
'submitLimit' => 0, | |
'formid' => 'remind', | |
'controller' => 'Reminder', | |
'rules' => '{ | |
"email":{ | |
"required":"Введите email", | |
"email":"Неверный email" | |
} | |
}', | |
'formTpl' => 'password_restore_tpl', | |
'messagesOuterTpl' => '@CODE:<div class="" role="alert">[+messages+]</div>', | |
'successTpl' => '@CODE:<div class="">На email отправлено письмо с дальнейшими инструкциями</div>', | |
'subject' => 'Восстановление пароля на сайте x.ru', | |
'resetTo' => 7999, | |
'reportTpl' => '@CODE:<p>Для восстановления пароля перейдите по ссылке <a href="[+reset.url+]">[+reset.url+]</a></p>', | |
'resetReportTpl' => '@CODE: <p>Ваш новый пароль: [+newpassword+]</p>', | |
'resetSuccessTpl' => '@CODE: <div class="text-center">Отправлено письмо с новым паролем</div>', | |
'errorTpl' => '@CODE:<span class="text-danger">[+message+]</span>', | |
'errorClass' => ' has-error', | |
'requiredClass' => ' has-warning', | |
'skipTpl' => '@CODE: <div class=" alert-info">Авторизованные пользователи не могут восстанавливать пароль</div>', | |
) | |
); | |
echo $data; | |
exit(); | |
break; | |
default: | |
//$modx->sendForward($modx->config['error_page']); | |
break; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>Поздравляем вас, дорогой друг!</p> | |
<p>Вы зарегистрировались в интернет-магазине «<a href="https://x.ru">x</a>»</p> | |
<p>Ваш пароль: [+user.password+]</p> | |
<p>Чтобы процесс оформления заказа в нашем магазине был для вас более комфортным, | |
рекомендуем заполнить раздел «Профиль» в вашем личном кабинете. </p> | |
<p>Спасибо, что вы с нами!</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="modal-auth"> | |
<div class="head"><h3 class="modal-auth-restore">Восстановление пароля</h3></div> | |
<form method="post" id="pass_restore_form"> | |
[+form.messages+] | |
<input type="hidden" name="formid" value="remind"> | |
<div class="inputIcon"> | |
<input name="email" class="input [+email.errorClass+][+email.requiredClass+]" placeholder="E-mail" type="text" value="[+email.value+]"> | |
<div class="inputIcon__item email"></div> | |
<label class="inputIcon__icon name email" ></label> | |
[+email.error+] | |
</div> | |
<div class="form3__text">Укажите e-mail, который использовали для регистрации. На него будет отправлена инструкция для восстановления пароля</div> | |
<input class="button buttonRed CartModal__but bt" type="submit" value="Отправить"> | |
</form> | |
<div class="bottom_links"> | |
<div class="modal-auth-auth"> | |
<a data-fancybox data-auth data-src="#lk_auth" href="javascript:;">Войти</a> | |
</div> | |
<div class="modal-auth-auth"> | |
<a data-fancybox data-auth data-src="#lk_reg" href="javascript:;">Регистрация</a> | |
</div> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="modal-auth"> | |
<div class="head"><h3>Регистрация</h3></div> | |
<form method="post" id="register_form"> | |
[+form.messages+] | |
<input type="hidden" name="formid" value="register"> | |
<div class="inputIcon "> | |
<input value="[+email.value+]" class="input [+email.errorClass+][+email.requiredClass+]" placeholder="E-mail" type="text" name="email" size="30" required=""> | |
<div class="inputIcon__item email"></div> | |
<label class="inputIcon__icon email"></label> | |
[+email.error+] | |
</div> | |
<div class="inputIcon"> | |
<input name="password" class="input [+password.errorClass+][+password.requiredClass+]" placeholder="Пароль" type="password"> | |
<div class="inputIcon__item lock"></div> | |
<label class="inputIcon__icon lock"></label> | |
[+password.error+] | |
</div> | |
<div class="form3__text">Нажимая на кнопку «Регистрация», вы соглашаетесь с <a target="_blank" class="link" href="[~3669~]">Пользовательским соглашением и условиями продажи.</a></div> | |
<input class="button buttonRed CartModal__but bt" type="submit" value="Регистрация"> | |
<div class="bottom_links"> | |
<div class=" modal-auth-auth"> | |
<a data-fancybox="" data-auth="" data-src="#lk_auth" href="javascript:;">Уже зарегистрированы?</a> | |
</div> | |
</div> | |
</form> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment