1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-06-16 23:00:51 +03:00

Компонент auth

This commit is contained in:
Denis Shakhov 2014-07-14 23:42:50 +07:00
parent ceeda1f1b7
commit ae3d35f18e
27 changed files with 446 additions and 325 deletions

View file

@ -43,12 +43,10 @@ class ActionLogin extends Action {
protected function RegisterEvent() {
$this->AddEvent('index','EventLogin');
$this->AddEvent('exit','EventExit');
$this->AddEvent('reminder','EventReminder');
$this->AddEvent('reactivation','EventReactivation');
$this->AddEvent('reset','EventReset');
$this->AddEvent('ajax-login','EventAjaxLogin');
$this->AddEvent('ajax-reminder','EventAjaxReminder');
$this->AddEvent('ajax-reactivation','EventAjaxReactivation');
$this->AddEvent('ajax-reset','EventAjaxReset');
}
/**
* Ajax авторизация
@ -87,7 +85,7 @@ class ActionLogin extends Action {
if ($oUser->getPassword()==func_encrypt(getRequest('password'))) {
if (!$oUser->getActivate()) {
$this->Message_AddErrorSingle($this->Lang_Get('user_not_activated', array('reactivation_path' => Router::GetPath('login') . 'reactivation')));
$this->Message_AddErrorSingle($this->Lang_Get('auth.notices.not_activated', array('reactivation_path' => Router::GetPath('registration') . 'reactivation')));
return;
}
$bRemember=getRequest('remember',false) ? true : false;
@ -119,39 +117,7 @@ class ActionLogin extends Action {
}
$this->Message_AddErrorSingle($this->Lang_Get('user_login_bad'));
}
/**
* Повторный запрос активации
*/
protected function EventReactivation() {
if($this->User_GetUserCurrent()) {
Router::Location(Router::GetPath('/'));
}
$this->Viewer_AddHtmlTitle($this->Lang_Get('reactivation'));
}
/**
* Ajax повторной активации
*/
protected function EventAjaxReactivation() {
$this->Viewer_SetResponseAjax('json');
if ((func_check(getRequestStr('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequestStr('mail')))) {
if ($oUser->getActivate()) {
$this->Message_AddErrorSingle($this->Lang_Get('registration_activate_error_reactivate'));
return;
} else {
$oUser->setActivateKey(md5(func_generator() . time()));
if ($this->User_Update($oUser)) {
$this->Message_AddNotice($this->Lang_Get('reactivation_send_link'));
$this->Notify_SendReactivationCode($oUser);
return;
}
}
}
$this->Message_AddErrorSingle($this->Lang_Get('password_reminder_bad_email'));
$this->Message_AddErrorSingle($this->Lang_Get('auth.login.notices.error_login'));
}
/**
* Обрабатываем процесс залогинивания
@ -165,7 +131,7 @@ class ActionLogin extends Action {
if($this->User_GetUserCurrent()) {
Router::Location(Router::GetPath('/'));
}
$this->Viewer_AddHtmlTitle($this->Lang_Get('login'));
$this->Viewer_AddHtmlTitle($this->Lang_Get('auth.login.title'));
}
/**
* Обрабатываем процесс разлогинивания
@ -179,7 +145,7 @@ class ActionLogin extends Action {
/**
* Ajax запрос на восстановление пароля
*/
protected function EventAjaxReminder() {
protected function EventAjaxReset() {
/**
* Устанвливаем формат Ajax ответа
*/
@ -199,22 +165,22 @@ class ActionLogin extends Action {
$oReminder->setIsUsed(0);
$oReminder->setUserId($oUser->getId());
if ($this->User_AddReminder($oReminder)) {
$this->Message_AddNotice($this->Lang_Get('password_reminder_send_link'));
$this->Message_AddNotice($this->Lang_Get('auth.notices.success_send_password'));
$this->Notify_SendReminderCode($oUser,$oReminder);
return;
}
}
$this->Message_AddError($this->Lang_Get('password_reminder_bad_email'),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('auth.notices.error_bad_email'),$this->Lang_Get('error'));
}
/**
* Обработка напоминания пароля, подтверждение смены пароля
*
*/
protected function EventReminder() {
protected function EventReset() {
/**
* Устанавливаем title страницы
*/
$this->Viewer_AddHtmlTitle($this->Lang_Get('password_reminder'));
$this->Viewer_AddHtmlTitle($this->Lang_Get('auth.reset.title'));
/**
* Проверка кода на восстановление пароля и генерация нового пароля
*/
@ -231,12 +197,12 @@ class ActionLogin extends Action {
$oReminder->setIsUsed(1);
$this->User_UpdateReminder($oReminder);
$this->Notify_SendReminderPassword($oUser,$sNewPassword);
$this->SetTemplateAction('reminder_confirm');
$this->SetTemplateAction('reset_confirm');
return ;
}
}
}
$this->Message_AddErrorSingle($this->Lang_Get('password_reminder_bad_code'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('auth.reset.alerts.error_bad_code'), $this->Lang_Get('error'));
return Router::Action('error');
}
}

View file

@ -31,20 +31,20 @@ class ActionRegistration extends Action {
* Проверяем аторизован ли юзер
*/
if ($this->User_IsAuthorization()) {
$this->Message_AddErrorSingle($this->Lang_Get('registration_is_authorization'),$this->Lang_Get('attention'));
$this->Message_AddErrorSingle($this->Lang_Get('auth.registration.notices.already_registered'),$this->Lang_Get('attention'));
return Router::Action('error');
}
/**
* Если включены инвайты то перенаправляем на страницу регистрации по инвайтам
*/
if (!$this->User_IsAuthorization() and Config::Get('general.reg.invite') and !in_array(Router::GetActionEvent(),array('invite','activate','confirm')) and !$this->CheckInviteRegister()) {
if (!$this->User_IsAuthorization() and Config::Get('general.reg.invite') and !in_array(Router::GetActionEvent(),array('invite','activate','reactivation','confirm')) and !$this->CheckInviteRegister()) {
return Router::Action('registration','invite');
}
$this->SetDefaultEvent('index');
/**
* Устанавливаем title страницы
*/
$this->Viewer_AddHtmlTitle($this->Lang_Get('registration'));
$this->Viewer_AddHtmlTitle($this->Lang_Get('auth.registration.title'));
}
/**
* Регистрируем евенты
@ -55,9 +55,11 @@ class ActionRegistration extends Action {
$this->AddEvent('confirm','EventConfirm');
$this->AddEvent('activate','EventActivate');
$this->AddEvent('invite','EventInvite');
$this->AddEvent('reactivation','EventReactivation');
$this->AddEvent('ajax-validate-fields','EventAjaxValidateFields');
$this->AddEvent('ajax-registration','EventAjaxRegistration');
$this->AddEvent('ajax-reactivation','EventAjaxReactivation');
}
@ -216,7 +218,7 @@ class ActionRegistration extends Action {
$sUrl=getRequestStr('return-path');
}
$this->Viewer_AssignAjax('sUrlRedirect',$sUrl ? $sUrl : Router::GetPath('/'));
$this->Message_AddNoticeSingle($this->Lang_Get('registration_ok'));
$this->Message_AddNoticeSingle($this->Lang_Get('auth.registration.notices.success'));
}
} else {
$this->Message_AddErrorSingle($this->Lang_Get('system_error'));
@ -258,14 +260,14 @@ class ActionRegistration extends Action {
*
*/
if ($oUser and $oUser->getActivate()) {
$this->Message_AddErrorSingle($this->Lang_Get('registration_activate_error_reactivate'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('auth.registration.notices.error_reactivate'),$this->Lang_Get('error'));
return Router::Action('error');
}
/**
* Если что то не то
*/
if ($bError) {
$this->Message_AddErrorSingle($this->Lang_Get('registration_activate_error_code'),$this->Lang_Get('error'));
$this->Message_AddErrorSingle($this->Lang_Get('auth.registration.notices.error_code'),$this->Lang_Get('error'));
return Router::Action('error');
}
/**
@ -285,6 +287,38 @@ class ActionRegistration extends Action {
return Router::Action('error');
}
}
/**
* Повторный запрос активации
*/
protected function EventReactivation() {
if($this->User_GetUserCurrent()) {
Router::Location(Router::GetPath('/'));
}
$this->Viewer_AddHtmlTitle($this->Lang_Get('auth.reactivation.title'));
}
/**
* Ajax повторной активации
*/
protected function EventAjaxReactivation() {
$this->Viewer_SetResponseAjax('json');
if ((func_check(getRequestStr('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequestStr('mail')))) {
if ($oUser->getActivate()) {
$this->Message_AddErrorSingle($this->Lang_Get('auth.registration.notices.error_reactivate'));
return;
} else {
$oUser->setActivateKey(md5(func_generator() . time()));
if ($this->User_Update($oUser)) {
$this->Message_AddNotice($this->Lang_Get('auth.reactivation.notices.success'));
$this->Notify_SendReactivationCode($oUser);
return;
}
}
}
$this->Message_AddErrorSingle($this->Lang_Get('auth.notices.error_bad_email'));
}
/**
* Обработка кода приглашения при включеном режиме инвайтов
*
@ -312,7 +346,7 @@ class ActionRegistration extends Action {
}
return Router::Action('registration');
} else {
$this->Message_AddError($this->Lang_Get('registration_invite_code_error'),$this->Lang_Get('error'));
$this->Message_AddError($this->Lang_Get('auth.invite.alerts.error_code'),$this->Lang_Get('error'));
}
}
}

View file

@ -64,7 +64,7 @@ class ModuleUser_EntityUser extends Entity {
if ($this->User_CheckLogin($sValue)) {
return true;
}
return $this->Lang_Get('registration_login_error');
return $this->Lang_Get('auth.registration.notices.error_login');
}
/**
* Проверка логина на существование
@ -77,7 +77,7 @@ class ModuleUser_EntityUser extends Entity {
if (!$this->User_GetUserByLogin($sValue)) {
return true;
}
return $this->Lang_Get('registration_login_error_used');
return $this->Lang_Get('auth.registration.notices.error_login_used');
}
/**
* Проверка емайла на существование
@ -90,7 +90,7 @@ class ModuleUser_EntityUser extends Entity {
if (!$this->User_GetUserByMail($sValue)) {
return true;
}
return $this->Lang_Get('registration_mail_error_used');
return $this->Lang_Get('auth.registration.notices.error_mail_used');
}
/**

View file

@ -35,28 +35,33 @@ ls.user = (function ($) {
this.options = $.extend({}, _defaults, options);
// TODO: Перенести в модуль auth
/* Авторизация */
ls.ajax.form(aRouter.login + 'ajax-login', '.js-form-login', function (result, status, xhr, form) {
result.sUrlRedirect && (window.location = result.sUrlRedirect);
ls.hook.run('ls_user_login_after', [form, result]);
$('.js-auth-login-form').on('submit', function (e) {
ls.ajax.submit(aRouter.login + 'ajax-login', $(this), function ( response ) {
response.sUrlRedirect && (window.location = response.sUrlRedirect);
});
e.preventDefault();
});
/* Регистрация */
ls.ajax.form(aRouter.registration + 'ajax-registration', '.js-form-registration', function (result, status, xhr, form) {
result.sUrlRedirect && (window.location = result.sUrlRedirect);
ls.hook.run('ls_user_registration_after', [form, result]);
});
$('.js-auth-registration-form').on('submit', function (e) {
ls.ajax.submit(aRouter.registration + 'ajax-registration', $(this), function ( response ) {
response.sUrlRedirect && (window.location = response.sUrlRedirect);
});
/* Регистрация Modal */
ls.ajax.form(aRouter.registration + 'ajax-registration', '.js-form-signup', function (result, status, xhr, form) {
result.sUrlRedirect && (window.location = result.sUrlRedirect);
ls.hook.run('ls_user_registration_after', [form, result]);
e.preventDefault();
});
/* Восстановление пароля */
ls.ajax.form(aRouter.login + 'ajax-reminder', '.js-form-recovery', function (result, status, xhr, form) {
result.sUrlRedirect && (window.location = result.sUrlRedirect);
ls.hook.run('ls_user_recovery_after', [form, result]);
$('.js-auth-reset-form').on('submit', function (e) {
ls.ajax.submit(aRouter.login + 'ajax-reset', $(this), function ( response ) {
response.sUrlRedirect && (window.location = response.sUrlRedirect);
});
e.preventDefault();
});
/* Повторный запрос на ссылку активации */

View file

@ -753,6 +753,161 @@ return array(
),
),
/**
* Авторизация
*/
'auth' => array(
'authorization' => 'Авторизация',
// Вход
'login' => array(
'title' => 'Войти',
'form' => array(
// Поля
'fields' => array(
'login' => array(
'label' => 'Логин или эл. почта'
),
'remember' => array(
'label' => 'Запомнить меня'
),
'submit' => array(
'text' => 'Войти'
)
)
),
// Всплывающие сообщения
'notices' => array(
'error_login' => 'Неправильно указан логин (e-mail) или пароль!',
'error_not_activated' => 'Вы не активировали вашу учетную запись. <br/> <a href="%%reactivation_path%%">Повторный запрос активации</a>'
),
),
// Повторный запрос активации
'reactivation' => array(
'title' => 'Повторный запрос активации',
'form' => array(
// Поля
'fields' => array(
'mail' => array(
'label' => 'Ваш e-mail'
),
'submit' => array(
'text' => 'Получить ссылку на активацию'
)
)
),
// Всплывающие сообщения
'notices' => array(
'success' => 'Ссылка для активации отправлена на ваш адрес электронной почты',
)
),
// Сброс пароля
'reset' => array(
'title' => 'Восстановление пароля',
'form' => array(
// Поля
'fields' => array(
'mail' => array(
'label' => 'Ваш e-mail'
),
'submit' => array(
'text' => 'Получить ссылку на изменение пароля'
)
)
),
// Всплывающие сообщения
'notices' => array(
'success_send_password' => 'Новый пароль отправлен на ваш адрес электронной почты',
'success_send_link' => 'Ссылка для восстановления пароля отправлена на ваш адрес электронной почты',
),
// Сообщения
'alerts' => array(
'error_bad_code' => 'Неверный код на восстановление пароля.',
)
),
// Регистрация по приглашению
'invite' => array(
'title' => 'Регистрация по приглашению',
'form' => array(
// Поля
'fields' => array(
'code' => array(
'label' => 'Код приглашения'
),
'submit' => array(
'text' => 'Проверить код'
)
),
),
// Сообщения
'alerts' => array(
'error_code' => 'Неверный код приглашения',
)
),
// Регистрация
'registration' => array(
'title' => 'Регистрация',
'form' => array(
// Поля
'fields' => array(
'password_confirm' => array(
'label' => 'Повторите пароль'
),
'submit' => array(
'text' => 'Зарегистрироваться'
)
)
),
'confirm' => array(
'title' => 'Активация аккаунта',
'text' => 'Вы почти зарегистрировались, осталось только активировать аккаунт. Инструкции по активации отправлены по электронной почте на адрес, указанный при регистрации.'
),
// Сообщения
'notices' => array(
'already_registered' => 'Вы уже зарегистрированы у нас и даже авторизованы!',
'success' => 'Поздравляем! Регистрация прошла успешно',
'success_activate' => 'Поздравляем! Ваш аккаунт успешно активирован.',
'error_login' => 'Неверный логин, допустим от 3 до 30 символов',
'error_login_used' => 'Этот логин уже занят',
'error_mail_used' => 'Этот e-mail уже используется',
'error_reactivate' => 'Ваш аккаунт уже активирован',
'error_code' => 'Неверный код активации!'
),
),
// Общие лэйблы
'labels' => array(
'login' => 'Логин',
'password' => 'Пароль',
'mail' => 'E-mail',
'captcha' => 'Введите цифры и буквы',
),
// Общие всплывающие сообщения
'notices' => array(
'error_bad_email' => 'Пользователь с таким e-mail не найден',
),
),
// TODO: Удалить, используется в ActionSubscribe
'registration_mail_error' => 'Неверный формат e-mail',
/**
* Почта
*/
@ -943,16 +1098,6 @@ return array(
'user_settings' => 'Настройки',
'user_settings_profile' => 'профиля',
'user_settings_tuning' => 'сайта',
'user_login' => 'Логин или эл. почта',
'user_login_submit' => 'Войти',
'user_login_remember' => 'Запомнить меня',
'user_login_bad' => 'Что-то не так! Вероятно, неправильно указан логин (e-mail) или пароль.',
'user_not_activated' => 'Вы не активировали вашу учетную запись. <br/> <a href="%%reactivation_path%%">Повторный запрос активации</a>',
'user_password' => 'Пароль',
'user_password_reminder' => 'Напомнить пароль',
'user_exit_notice' => 'Обязательно приходите еще.',
'user_authorization' => 'Авторизация',
'user_registration' => 'Регистрация',
'user_write_prvmsg' => 'Написать письмо',
'user_friend_add' => 'Добавить в друзья',
'user_friend_add_ok' => 'У вас появился новый друг',
@ -1006,44 +1151,6 @@ return array(
'people_menu_users_all' => 'Все',
'people_menu_users_online' => 'Онлайн',
'people_menu_users_new' => 'Новые',
/**
* Регистрация
*/
'registration_invite' => 'Регистрация по приглашению',
'registration_invite_code' => 'Код приглашения',
'registration_invite_code_error' => 'Неверный код приглашения',
'registration_invite_check' => 'Проверить код',
'registration_activate_ok' => 'Поздравляем! Ваш аккаунт успешно активирован.',
'registration_activate_error_code' => 'Неверный код активации!',
'registration_activate_error_reactivate' => 'Ваш аккаунт уже активирован',
'registration_confirm_header' => 'Активация аккаунта',
'registration_confirm_text' => 'Вы почти зарегистрировались, осталось только активировать аккаунт. Инструкции по активации отправлены по электронной почте на адрес, указанный при регистрации.',
'registration' => 'Регистрация',
'registration_is_authorization' => 'Вы уже зарегистрированы у нас и даже авторизованы!',
'registration_login' => 'Логин',
'registration_login_error' => 'Неверный логин, допустим от 3 до 30 символов',
'registration_login_error_used' => 'Этот логин уже занят',
'registration_login_notice' => 'Может состоять только из букв (A-Z a-z), цифр (0-9). Знак подчеркивания (_) лучше не использовать. Длина логина не может быть меньше 3 и больше 30 символов.',
'registration_mail' => 'E-mail',
'registration_mail_error' => 'Неверный формат e-mail',
'registration_mail_error_used' => 'Этот e-mail уже используется',
'registration_mail_notice' => 'Для проверки регистрации и в целях безопасности нам нужен адрес вашей электропочты.',
'registration_password' => 'Пароль',
'registration_password_error' => 'Неверный пароль, допустим от 5 символов',
'registration_password_error_different' => 'Пароли не совпадают',
'registration_password_notice' => 'Должен содержать не менее 5 символов и не может совпадать с логином. Не используйте простые пароли, будьте разумны.',
'registration_password_retry' => 'Повторите пароль',
'registration_captcha' => 'Введите цифры и буквы',
'registration_captcha_error' => 'Неверный код',
'registration_submit' => 'Зарегистрироваться',
'registration_ok' => 'Поздравляем! Регистрация прошла успешно',
/**
* Повторный запрос активации
*/
"reactivation" => "Повторный запрос активации",
"reactivation_submit" => "Получить ссылку на активацию",
"reactivation_send_link" => "Ссылка для активации отправлена на ваш адрес электронной почты.",
/**
* Меню профиля пользователя
@ -1208,16 +1315,6 @@ return array(
'settings_menu_tuning' => 'Настройки сайта',
'settings_menu_invite' => 'Инвайты',
'settings_menu_account' => 'Аккаунт',
/**
* Восстановление пароля
*/
'password_reminder' => 'Восстановление пароля',
'password_reminder_email' => 'Ваш e-mail',
'password_reminder_submit' => 'Получить ссылку на изменение пароля',
'password_reminder_send_password' => 'Новый пароль отправлен на ваш адрес электронной почты.',
'password_reminder_send_link' => 'Ссылка для восстановления пароля отправлена на ваш адрес электронной почты.',
'password_reminder_bad_code' => 'Неверный код на восстановление пароля.',
'password_reminder_bad_email' => 'Пользователь с таким e-mail не найден',
/**
* Панель
*/

View file

@ -2,14 +2,16 @@
* Страница входа
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.user_authorization}{/block}
{block 'layout_page_title'}
{$aLang.auth.login.title}
{/block}
{block name='layout_content'}
{include file='forms/auth/form.auth.login.tpl'}
{block 'layout_content'}
{include 'components/auth/auth.login.tpl' showExtra=true}
{/block}

View file

@ -1,15 +0,0 @@
{**
* Форма запроса повторной активации аккаунта
*}
{extends file='layouts/layout.base.tpl'}
{block name='layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.reactivation}{/block}
{block name='layout_content'}
{include file='forms/auth/form.auth.reactivation.tpl'}
{/block}

View file

@ -1,15 +0,0 @@
{**
* Форма восстановления пароля
*}
{extends file='layouts/layout.base.tpl'}
{block name='layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.password_reminder}{/block}
{block name='layout_content'}
{include file='forms/auth/form.auth.recovery.tpl'}
{/block}

View file

@ -1,16 +0,0 @@
{**
* Восстановление пароля.
* Пароль отправлен на емэйл пользователя.
*}
{extends file='layouts/layout.base.tpl'}
{block name='layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.password_reminder}{/block}
{block name='layout_content'}
{$aLang.password_reminder_send_password}
{/block}

View file

@ -0,0 +1,17 @@
{**
* Форма восстановления пароля
*}
{extends 'layouts/layout.base.tpl'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block 'layout_page_title'}
{$aLang.auth.reset.title}
{/block}
{block 'layout_content'}
{include 'components/auth/auth.reset.tpl'}
{/block}

View file

@ -0,0 +1,18 @@
{**
* Восстановление пароля.
* Пароль отправлен на емэйл пользователя.
*}
{extends 'layouts/layout.base.tpl'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block 'layout_page_title'}
{$aLang.auth.reset.title}
{/block}
{block 'layout_content'}
{$aLang.auth.reset.notices.success_send_password}
{/block}

View file

@ -2,14 +2,16 @@
* Уведомление об успешной регистрации
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.registration_activate_ok}{/block}
{block 'layout_page_title'}
{$aLang.auth.registration.notices.success_activate}
{/block}
{block name='layout_content'}
{block 'layout_content'}
<a href="{router page='/'}">{$aLang.site_go_main}</a>
{/block}

View file

@ -2,16 +2,18 @@
* Просьба перейти по ссылке отправленной на емэйл для активации аккаунта
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.registration_confirm_header}{/block}
{block 'layout_page_title'}
{$aLang.auth.registration.confirm.title}
{/block}
{block name='layout_content'}
{$aLang.registration_confirm_text}<br /><br />
{block 'layout_content'}
{$aLang.auth.registration.confirm.text}<br /><br />
<a href="{router page='/'}">{$aLang.site_go_main}</a>
{/block}

View file

@ -2,14 +2,16 @@
* Регистрация
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.registration}{/block}
{block 'layout_page_title'}
{$aLang.auth.registration.title}
{/block}
{block name='layout_content'}
{include file='forms/auth/form.auth.signup.tpl'}
{block 'layout_content'}
{include 'components/auth/auth.registration.tpl'}
{/block}

View file

@ -2,14 +2,16 @@
* Регистрация через инвайт
*}
{extends file='layouts/layout.base.tpl'}
{extends 'layouts/layout.base.tpl'}
{block name='layout_options'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block name='layout_page_title'}{$aLang.registration_invite}{/block}
{block 'layout_page_title'}
{$aLang.auth.invite.title}
{/block}
{block name='layout_content'}
{include file='forms/auth/form.auth.invite.tpl'}
{block 'layout_content'}
{include 'components/auth/auth.invite.tpl'}
{/block}

View file

@ -0,0 +1,17 @@
{**
* Форма запроса повторной активации аккаунта
*}
{extends 'layouts/layout.base.tpl'}
{block 'layout_options'}
{$bNoSidebar = true}
{/block}
{block 'layout_page_title'}
{$aLang.auth.reactivation.title}
{/block}
{block 'layout_content'}
{include 'components/auth/auth.reactivation.tpl'}
{/block}

View file

@ -0,0 +1,12 @@
{**
* Форма регистрации через инвайт
*}
<form action="{router page='registration'}invite/" method="post">
{include 'components/field/field.text.tpl'
sName = 'invite_code'
aRules = [ 'required' => true, 'type' => 'alphanum' ]
sLabel = $aLang.auth.invite.form.fields.code.label}
{include 'components/button/button.tpl' sName='submit_invite' sMods='primary' sText=$aLang.auth.invite.form.fields.submit.text}
</form>

View file

@ -0,0 +1,55 @@
{**
* Форма входа
*}
{$redirectUrl = $smarty.local.redirectUrl|default:$PATH_WEB_CURRENT}
{hook run='login_begin'}
<form action="{router page='login'}" method="post" class="js-auth-login-form">
{hook run='form_login_begin'}
{* Логин *}
{include 'components/field/field.text.tpl'
sName = 'login'
aRules = [ 'required' => true, 'rangelength' => '[2,20]' ]
sLabel = $aLang.auth.login.form.fields.login.label}
{* Пароль *}
{include 'components/field/field.text.tpl'
sName = 'password'
sType = 'password'
aRules = [ 'required' => true, 'rangelength' => '[2,20]' ]
sLabel = $aLang.auth.labels.password}
{* Каптча *}
{if Config::Get('general.login.captcha')}
{include 'components/field/field.captcha.tpl'
sName = 'captcha'
sCaptchaName = 'user_auth'
sLabel = $aLang.auth.labels.captcha}
{/if}
{* Запомнить *}
{include 'components/field/field.checkbox.tpl'
sName = 'remember'
sLabel = $aLang.auth.login.form.fields.remember.label
bChecked = true}
{hook run='form_login_end'}
{if $redirectUrl}
{include 'components/field/field.hidden.tpl' sName='return-path' sValue=$redirectUrl}
{/if}
{include 'components/button/button.tpl' sName='submit_login' sMods='primary' sText=$aLang.auth.login.form.fields.submit.text}
</form>
{if $smarty.local.showExtra}
<div class="pt-20">
<a href="{router page='registration'}">{$aLang.auth.registration.title}</a><br />
<a href="{router page='login'}reset/">{$aLang.auth.reset.title}</a>
</div>
{/if}
{hook run='login_end'}

View file

@ -0,0 +1,13 @@
{**
* Форма запроса повторной активации аккаунта
*}
<form action="{router page='registration'}reactivation/" method="post" class="js-form-reactivation">
{* E-mail *}
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.auth.reactivation.form.fields.mail.label}
{include 'components/button/button.tpl' sName='submit_reactivation' sMods='primary' sText=$aLang.auth.reactivation.form.fields.submit.text}
</form>

View file

@ -4,50 +4,53 @@
* isModal Если true, то форма выводится в модальном окне
*}
{hook run='registration_begin' isPopup=$isModal}
{$redirectUrl = $smarty.local.redirectUrl|default:$PATH_WEB_CURRENT}
<form action="{router page='registration'}" method="post" class="{if $isModal}js-form-signup{else}js-form-registration{/if}">
{hook run='form_registration_begin' isPopup=$isModal}
{hook run='registration_begin'}
<form action="{router page='registration'}" method="post" class="js-auth-registration-form">
{hook run='form_registration_begin'}
{* Логин *}
{include file='components/field/field.text.tpl'
{include 'components/field/field.text.tpl'
sName = 'login'
aRules = [ 'required' => true, 'rangelength' => '[2,20]', 'remote' => "{router page='registration'}ajax-validate-fields", 'remote-method' => 'POST' ]
sLabel = $aLang.user_login}
sLabel = $aLang.auth.labels.login}
{* E-mail *}
{include file='components/field/field.text.tpl'
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.registration_mail}
sLabel = $aLang.auth.labels.mail}
{* Пароль *}
{include file='components/field/field.text.tpl'
{include 'components/field/field.text.tpl'
sName = 'password'
sType = 'password'
aRules = [ 'required' => true, 'rangelength' => '[2,20]' ]
sLabel = $aLang.registration_password
sLabel = $aLang.auth.labels.password
sInputClasses = 'js-input-password-reg'}
{* Повторите пароль *}
{include file='components/field/field.text.tpl'
{include 'components/field/field.text.tpl'
sName = 'password_confirm'
sType = 'password'
aRules = [ 'required' => true, 'rangelength' => '[2,20]', 'equalto' => '.js-input-password-reg' ]
sLabel = $aLang.registration_password_retry}
sLabel = $aLang.auth.registration.form.fields.password_confirm.label}
{* Каптча *}
{include file='components/field/field.captcha.tpl'
{include 'components/field/field.captcha.tpl'
sName = 'captcha'
sCaptchaName = 'user_signup'
sLabel = $aLang.registration_captcha}
sLabel = $aLang.auth.labels.captcha}
{hook run='form_registration_end' isPopup=$isModal}
{hook run='form_registration_end'}
{if $isModal}
{include file='components/field/field.hidden.tpl' sName='return-path' sValue=$PATH_WEB_CURRENT}
{if $redirectUrl}
{include 'components/field/field.hidden.tpl' sName='return-path' sValue=$redirectUrl}
{/if}
{include file='components/button/button.tpl' sName='submit_register' sMods='primary' sText=$aLang.registration_submit}
{include 'components/button/button.tpl' sName='submit_register' sMods='primary' sText=$aLang.auth.registration.form.fields.submit.text}
</form>
{hook run='registration_end' isPopup=$isModal}
{hook run='registration_end'}

View file

@ -0,0 +1,13 @@
{**
* Форма восстановления пароля
*}
<form action="{router page='login'}reminder/" method="post" class="js-auth-reset-form">
{* E-mail *}
{include 'components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.auth.reset.form.fields.mail.label}
{include 'components/button/button.tpl' sName='submit_reset' sMods='primary' sText=$aLang.auth.reset.form.fields.submit.text}
</form>

View file

@ -1,13 +0,0 @@
{**
* Форма регистрации через инвайт
*}
<form action="{router page='registration'}invite/" method="post">
{include file='components/field/field.text.tpl'
sName = 'invite_code'
aRules = [ 'required' => true, 'type' => 'alphanum' ]
sLabel = $aLang.registration_invite_code
sInputClasses = 'width-300'}
{include file='components/button/button.tpl' sName='submit_invite' sMods='primary' sText=$aLang.registration_invite_check}
</form>

View file

@ -1,52 +0,0 @@
{**
* Форма входа
*
* isModal Если true, то форма выводится в модальном окне
*}
{hook run='login_begin' isModal=$isModal}
<form action="{router page='login'}" method="post" class="js-form-login">
{hook run='form_login_begin' isModal=$isModal}
{* Логин *}
{include file='components/field/field.text.tpl'
sName = 'login'
aRules = [ 'required' => true, 'rangelength' => '[2,20]' ]
sLabel = $aLang.user_login}
{* Пароль *}
{include file='components/field/field.text.tpl'
sName = 'password'
sType = 'password'
aRules = [ 'required' => true, 'rangelength' => '[2,20]' ]
sLabel = $aLang.user_password}
{* Каптча *}
{if Config::Get('general.login.captcha')}
{include file='components/field/field.captcha.tpl'
sName = 'captcha'
sCaptchaName = 'user_auth'
sLabel = $aLang.registration_captcha}
{/if}
{* Запомнить *}
{include file='components/field/field.checkbox.tpl'
sName = 'remember'
sLabel = $aLang.user_login_remember
bChecked = true}
{hook run='form_login_end' isModal=$isModal}
{include file='components/field/field.hidden.tpl' sName='return-path' value=$PATH_WEB_CURRENT}
{include file='components/button/button.tpl' sName='submit_login' sMods='primary' sText=$aLang.user_login_submit}
</form>
{if ! $isModal}
<div class="pt-20">
<a href="{router page='registration'}">{$aLang.user_registration}</a><br />
<a href="{router page='login'}reminder/">{$aLang.user_password_reminder}</a>
</div>
{/if}
{hook run='login_end' isModal=$isModal}

View file

@ -1,13 +0,0 @@
{**
* Форма запроса повторной активации аккаунта
*}
<form action="{router page='login'}reactivation/" method="post" class="js-form-reactivation">
{* E-mail *}
{include file='components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.password_reminder_email}
{include file='components/button/button.tpl' sName='submit_reactivation' sMods='primary' sText=$aLang.reactivation_submit}
</form>

View file

@ -1,15 +0,0 @@
{**
* Форма восстановления пароля
*
* isModal Если true, то форма выводится в модальном окне
*}
<form action="{router page='login'}reminder/" method="post" class="js-form-recovery">
{* E-mail *}
{include file='components/field/field.text.tpl'
sName = 'mail'
aRules = [ 'required' => true, 'type' => 'email' ]
sLabel = $aLang.password_reminder_email}
{include file='components/button/button.tpl' sName='submit_reactivation' sMods='primary' sText=$aLang.password_reminder_submit}
</form>

View file

@ -6,35 +6,35 @@
{extends 'components/modal/modal.tpl'}
{block name='modal_id'}modal-login{/block}
{block name='modal_class'}modal-login js-modal-default{/block}
{block name='modal_title'}{$aLang.user_authorization}{/block}
{block name='modal_attributes'}data-modal-center="false"{/block}
{block 'modal_id'}modal-login{/block}
{block 'modal_class'}modal-login js-modal-default{/block}
{block 'modal_title'}{$aLang.auth.authorization}{/block}
{block 'modal_attributes'}data-modal-center="false"{/block}
{block name='modal_content'}
{block 'modal_content'}
{include 'components/nav/nav.tabs.tpl' sName='block_tags' sActiveItem='all' sMods='pills' sClasses='' aItems=[
[ 'name' => 'login', 'text' => $aLang.user_login_submit, 'pane' => 'tab-pane-login' ],
[ 'name' => 'registration', 'text' => $aLang.registration, 'pane' => 'tab-pane-registration' ],
[ 'name' => 'reminder', 'text' => $aLang.password_reminder, 'pane' => 'tab-pane-reminder' ]
[ 'name' => 'login', 'text' => $aLang.auth.login.title, 'pane' => 'tab-pane-login' ],
[ 'name' => 'registration', 'text' => $aLang.auth.registration.title, 'pane' => 'tab-pane-registration' ],
[ 'name' => 'reset', 'text' => $aLang.auth.reset.title, 'pane' => 'tab-pane-reset' ]
]}
<div data-type="tab-panes">
<div class="tab-pane" id="tab-pane-login" data-type="tab-pane">
{include file='forms/auth/form.auth.login.tpl' isModal=true}
{include 'components/auth/auth.login.tpl'}
</div>
<div class="tab-pane" id="tab-pane-registration" data-type="tab-pane">
{if ! Config::Get('general.reg.invite')}
{include file='forms/auth/form.auth.signup.tpl' isModal=true}
{include 'components/auth/auth.registration.tpl'}
{else}
{include file='forms/auth/form.auth.invite.tpl' isModal=true}
{include 'components/auth/auth.invite.tpl'}
{/if}
</div>
<div class="tab-pane" id="tab-pane-reminder" data-type="tab-pane">
{include file='forms/auth/form.auth.recovery.tpl' isModal=true}
<div class="tab-pane" id="tab-pane-reset" data-type="tab-pane">
{include 'components/auth/auth.reset.tpl'}
</div>
</div>
{/block}
{block name='modal_footer'}{/block}
{block 'modal_footer'}{/block}

View file

@ -22,8 +22,8 @@
]}
{else}
{$aItems = [
[ 'text' => $aLang.user_login_submit, 'classes' => 'js-modal-toggle-login', 'url' => {router page='login'} ],
[ 'text' => $aLang.registration_submit, 'classes' => 'js-modal-toggle-registration', 'url' => {router page='registration'} ]
[ 'text' => $aLang.auth.login.title, 'classes' => 'js-modal-toggle-login', 'url' => {router page='login'} ],
[ 'text' => $aLang.auth.registration.title, 'classes' => 'js-modal-toggle-registration', 'url' => {router page='registration'} ]
]}
{/if}