From 869bd577fa429295831837625190c1649d2314d1 Mon Sep 17 00:00:00 2001 From: Igor Khohlov Date: Wed, 13 Jun 2012 11:46:40 +0300 Subject: [PATCH] reactivation --- classes/actions/ActionLogin.class.php | 49 ++++- classes/modules/notify/Notify.class.php | 172 ++++++++++-------- .../modules/user/mapper/User.mapper.class.php | 6 +- engine/lib/internal/template/js/user.js | 41 ++++- templates/language/english.php | 8 + templates/language/russian.php | 10 + .../actions/ActionLogin/reactivation.tpl | 26 +++ .../notify/english/notify.reactivation.tpl | 7 + .../notify/russian/notify.reactivation.tpl | 7 + 9 files changed, 242 insertions(+), 84 deletions(-) create mode 100644 templates/skin/synio/actions/ActionLogin/reactivation.tpl create mode 100644 templates/skin/synio/notify/english/notify.reactivation.tpl create mode 100644 templates/skin/synio/notify/russian/notify.reactivation.tpl diff --git a/classes/actions/ActionLogin.class.php b/classes/actions/ActionLogin.class.php index 7fa8e32d..2b651014 100644 --- a/classes/actions/ActionLogin.class.php +++ b/classes/actions/ActionLogin.class.php @@ -44,9 +44,11 @@ class ActionLogin extends Action { $this->AddEvent('index','EventLogin'); $this->AddEvent('exit','EventExit'); $this->AddEvent('reminder','EventReminder'); + $this->AddEvent('reactivation','EventReactivation'); $this->AddEvent('ajax-login','EventAjaxLogin'); $this->AddEvent('ajax-reminder','EventAjaxReminder'); + $this->AddEvent('ajax-reactivation','EventAjaxReactivation'); } /** * Ajax авторизация @@ -70,7 +72,12 @@ class ActionLogin extends Action { /** * Сверяем хеши паролей и проверяем активен ли юзер */ - if ($oUser->getPassword()==func_encrypt(getRequest('password')) and $oUser->getActivate()) { + + 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'))); + return; + } $bRemember=getRequest('remember',false) ? true : false; /** * Авторизуем @@ -89,7 +96,45 @@ class ActionLogin extends Action { } $this->Message_AddErrorSingle($this->Lang_Get('user_login_bad')); } - /** + + /** + * Повторный запрос активации + */ + protected function EventReactivation() + { + if($this->User_GetUserCurrent()) { + Router::Location(Config::Get('path.root.web').'/'); + } + + $this->Viewer_AddHtmlTitle($this->Lang_Get('reactivation')); + + } + + /** + * Ajax повторной активации + */ + protected function EventAjaxReactivation() + { + $this->Viewer_SetResponseAjax('json'); + + if ((func_check(getRequest('mail'), 'mail') and $oUser = $this->User_GetUserByMail(getRequest('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')); + } + + /** * Обрабатываем процесс залогинивания * По факту только отображение шаблона, дальше вступает в дело Ajax * diff --git a/classes/modules/notify/Notify.class.php b/classes/modules/notify/Notify.class.php index 3f277ef7..cbaeda20 100644 --- a/classes/modules/notify/Notify.class.php +++ b/classes/modules/notify/Notify.class.php @@ -32,7 +32,7 @@ class ModuleNotify extends Module { protected $oViewerLocal=null; /** * Массив заданий на удаленную публикацию - * + * * @var array */ protected $aTask=array(); @@ -48,14 +48,14 @@ class ModuleNotify extends Module { * Момент довольно спорный, но позволяет избавить основной шаблон от мусора уведомлений * */ - public function Init() { + public function Init() { if (!class_exists('ModuleViewer')) { require_once(Config::Get('path.root.engine')."/modules/viewer/Viewer.class.php"); } $this->oViewerLocal=$this->Viewer_GetLocalViewer(); $this->oMapper=Engine::GetMapper(__CLASS__); } - + /** * Отправляет юзеру уведомление о новом комментарии в его топике * @@ -82,15 +82,15 @@ class ModuleNotify extends Module { * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.comment_new.tpl')); - + /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -114,9 +114,9 @@ class ModuleNotify extends Module { $this->Mail_SetBody($sBody); $this->Mail_setHTML(); $this->Mail_Send(); - } + } } - + /** * Отправляет юзеру уведомление об ответе на его комментарий * @@ -144,13 +144,13 @@ class ModuleNotify extends Module { */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.comment_reply.tpl')); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -176,7 +176,7 @@ class ModuleNotify extends Module { $this->Mail_Send(); } } - + /** * Отправляет юзеру уведомление о новом топике в блоге, в котором он состоит * @@ -204,13 +204,13 @@ class ModuleNotify extends Module { */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.topic_new.tpl')); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -225,7 +225,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -236,24 +236,48 @@ class ModuleNotify extends Module { $this->Mail_Send(); } } - + /** + * Отправляет уведомление с новым линком активации + * + * @param ModuleUser_EntityUser $oUser + */ + public function SendReactivationCode(ModuleUser_EntityUser $oUser) { + /** + * Передаём в шаблон переменные + */ + $this->oViewerLocal->Assign('oUser',$oUser); + /** + * Формируем шаблон + */ + $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.reactivation.tpl')); + + /** + * Отправляем мыло + */ + $this->Mail_SetAdress($oUser->getMail(),$oUser->getLogin()); + $this->Mail_SetSubject($this->Lang_Get('notify_subject_reactvation')); + $this->Mail_SetBody($sBody); + $this->Mail_setHTML(); + $this->Mail_Send(); + } + /** * Отправляет уведомление при регистрации с активацией * * @param ModuleUser_EntityUser $oUser * @param string $sPassword */ - public function SendRegistrationActivate(ModuleUser_EntityUser $oUser,$sPassword) { + public function SendRegistrationActivate(ModuleUser_EntityUser $oUser,$sPassword) { /** * Передаём в шаблон переменные */ - $this->oViewerLocal->Assign('oUser',$oUser); + $this->oViewerLocal->Assign('oUser',$oUser); $this->oViewerLocal->Assign('sPassword',$sPassword); /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.registration_activate.tpl')); - + /** * Отправляем мыло */ @@ -263,24 +287,24 @@ class ModuleNotify extends Module { $this->Mail_setHTML(); $this->Mail_Send(); } - + /** * Отправляет уведомление о регистрации * * @param ModuleUser_EntityUser $oUser * @param string $sPassword */ - public function SendRegistration(ModuleUser_EntityUser $oUser,$sPassword) { + public function SendRegistration(ModuleUser_EntityUser $oUser,$sPassword) { /** * Передаём в шаблон переменные */ - $this->oViewerLocal->Assign('oUser',$oUser); + $this->oViewerLocal->Assign('oUser',$oUser); $this->oViewerLocal->Assign('sPassword',$sPassword); /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.registration.tpl')); - + /** * Отправляем мыло */ @@ -290,7 +314,7 @@ class ModuleNotify extends Module { $this->Mail_setHTML(); $this->Mail_Send(); } - + /** * Отправляет инвайт * @@ -298,25 +322,25 @@ class ModuleNotify extends Module { * @param string $sMailTo * @param ModuleUser_EntityInvite $oInvite */ - public function SendInvite(ModuleUser_EntityUser $oUserFrom,$sMailTo,ModuleUser_EntityInvite $oInvite) { + public function SendInvite(ModuleUser_EntityUser $oUserFrom,$sMailTo,ModuleUser_EntityInvite $oInvite) { /** * Передаём в шаблон переменные */ - $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); - $this->oViewerLocal->Assign('sMailTo',$sMailTo); + $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); + $this->oViewerLocal->Assign('sMailTo',$sMailTo); $this->oViewerLocal->Assign('oInvite',$oInvite); /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch('notify/'.$this->Lang_GetLang()."/notify.invite.tpl"); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $sMailTo, 'user_login' => null, @@ -331,7 +355,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -342,7 +366,7 @@ class ModuleNotify extends Module { $this->Mail_Send(); } } - + /** * Отправляет уведомление при новом личном сообщении * @@ -361,20 +385,20 @@ class ModuleNotify extends Module { * Передаём в шаблон переменные */ $this->oViewerLocal->Assign('oUserTo',$oUserTo); - $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); + $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); $this->oViewerLocal->Assign('oTalk',$oTalk); /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.talk_new.tpl')); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -389,7 +413,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -400,7 +424,7 @@ class ModuleNotify extends Module { $this->Mail_Send(); } } - + public function SendTalkCommentNew(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom,ModuleTalk_EntityTalk $oTalk,ModuleComment_EntityComment $oTalkComment) { /** * Проверяем можно ли юзеру рассылать уведомление @@ -412,7 +436,7 @@ class ModuleNotify extends Module { * Передаём в шаблон переменные */ $this->oViewerLocal->Assign('oUserTo',$oUserTo); - $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); + $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); $this->oViewerLocal->Assign('oTalk',$oTalk); $this->oViewerLocal->Assign('oTalkComment',$oTalkComment); /** @@ -420,13 +444,13 @@ class ModuleNotify extends Module { */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.talk_comment_new.tpl')); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -441,7 +465,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -452,14 +476,14 @@ class ModuleNotify extends Module { $this->Mail_Send(); } } - + /** * Отправляет пользователю сообщение о добавлении его в друзья * * @param ModuleUser_EntityUser $oUserTo * @param ModuleUser_EntityUser $oUserFrom */ - public function SendUserFriendNew(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom, $sText,$sPath) { + public function SendUserFriendNew(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom, $sText,$sPath) { /** * Проверяем можно ли юзеру рассылать уведомление */ @@ -470,22 +494,22 @@ class ModuleNotify extends Module { * Передаём в шаблон переменные */ $this->oViewerLocal->Assign('oUserTo',$oUserTo); - $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); + $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); $this->oViewerLocal->Assign('sText',$sText); $this->oViewerLocal->Assign('sPath',$sPath); - + /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.user_friend_new.tpl')); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -500,7 +524,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -518,27 +542,27 @@ class ModuleNotify extends Module { * @param ModuleUser_EntityUser $oUserTo * @param ModuleUser_EntityUser $oUserFrom */ - public function SendBlogUserInvite(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom, ModuleBlog_EntityBlog $oBlog,$sPath) { + public function SendBlogUserInvite(ModuleUser_EntityUser $oUserTo,ModuleUser_EntityUser $oUserFrom, ModuleBlog_EntityBlog $oBlog,$sPath) { /** * Передаём в шаблон переменные */ $this->oViewerLocal->Assign('oUserTo',$oUserTo); - $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); + $this->oViewerLocal->Assign('oUserFrom',$oUserFrom); $this->oViewerLocal->Assign('oBlog',$oBlog); $this->oViewerLocal->Assign('sPath',$sPath); - + /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath('notify.blog_invite_new.tpl')); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $oUserTo->getMail(), 'user_login' => $oUserTo->getLogin(), @@ -553,7 +577,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -563,19 +587,19 @@ class ModuleNotify extends Module { $this->Mail_setHTML(); $this->Mail_Send(); } - } - + } + /** * Уведомление при восстановлении пароля * * @param ModuleUser_EntityUser $oUser * @param ModuleUser_EntityReminder $oReminder */ - public function SendReminderCode(ModuleUser_EntityUser $oUser,ModuleUser_EntityReminder $oReminder) { + public function SendReminderCode(ModuleUser_EntityUser $oUser,ModuleUser_EntityReminder $oReminder) { /** * Передаём в шаблон переменные */ - $this->oViewerLocal->Assign('oUser',$oUser); + $this->oViewerLocal->Assign('oUser',$oUser); $this->oViewerLocal->Assign('oReminder',$oReminder); /** * Формируем шаблон @@ -597,11 +621,11 @@ class ModuleNotify extends Module { * @param ModuleUser_EntityUser $oUser * @param unknown_type $sNewPassword */ - public function SendReminderPassword(ModuleUser_EntityUser $oUser,$sNewPassword) { + public function SendReminderPassword(ModuleUser_EntityUser $oUser,$sNewPassword) { /** * Передаём в шаблон переменные */ - $this->oViewerLocal->Assign('oUser',$oUser); + $this->oViewerLocal->Assign('oUser',$oUser); $this->oViewerLocal->Assign('sNewPassword',$sNewPassword); /** * Формируем шаблон @@ -669,7 +693,7 @@ class ModuleNotify extends Module { * @param unknown_type $aAssign - ассоциативный массив для загрузки переменных в шаблон письма * @param unknown_type $sPluginName - плагин из которого происходит отправка */ - public function Send($oUserTo,$sTemplate,$sSubject,$aAssign=array(),$sPluginName=null) { + public function Send($oUserTo,$sTemplate,$sSubject,$aAssign=array(),$sPluginName=null) { if ($oUserTo instanceof ModuleUser_EntityUser) { $sMail=$oUserTo->getMail(); $sName=$oUserTo->getLogin(); @@ -682,19 +706,19 @@ class ModuleNotify extends Module { */ foreach ($aAssign as $k=>$v) { $this->oViewerLocal->Assign($k,$v); - } + } /** * Формируем шаблон */ $sBody=$this->oViewerLocal->Fetch($this->GetTemplatePath($sTemplate,$sPluginName)); /** - * Если в конфигураторе указан отложенный метод отправки, + * Если в конфигураторе указан отложенный метод отправки, * то добавляем задание в массив. В противном случае, * сразу отсылаем на email */ if(Config::Get('module.notify.delayed')) { $oNotifyTask=Engine::GetEntity( - 'Notify_Task', + 'Notify_Task', array( 'user_mail' => $sMail, 'user_login' => $sName, @@ -709,7 +733,7 @@ class ModuleNotify extends Module { } else { $this->oMapper->AddTask($oNotifyTask); } - } else { + } else { /** * Отправляем мыло */ @@ -720,22 +744,22 @@ class ModuleNotify extends Module { $this->Mail_Send(); } } - - + + /** - * При завершении работы модуля проверяем наличие + * При завершении работы модуля проверяем наличие * отложенных заданий в массиве и при необходимости * передаем их в меппер - */ + */ public function Shutdown() { if(!empty($this->aTask) && Config::Get('module.notify.delayed')) { $this->oMapper->AddTaskArray($this->aTask); $this->aTask=array(); } } - + /** - * Получает массив заданий на публикацию из базы + * Получает массив заданий на публикацию из базы * с указанным количественным ограничением (выборка FIFO) * * @param int $iLimit @@ -747,7 +771,7 @@ class ModuleNotify extends Module { : array(); } /** - * Отправляет на e-mail + * Отправляет на e-mail * * @param ModuleNotify_EntityTask $oTask */ @@ -771,12 +795,12 @@ class ModuleNotify extends Module { * Удаляет отложенные Notify-задания по списку идентификаторов * * @param array $aArrayId - * @return bool + * @return bool */ public function DeleteTaskByArrayId($aArrayId) { return $this->oMapper->DeleteTaskByArrayId($aArrayId); } - + /** * Возвращает путь к шаблону по переданному имени * @@ -784,12 +808,12 @@ class ModuleNotify extends Module { * @param string $sPluginName * @return string */ - public function GetTemplatePath($sName,$sPluginName=null) { + public function GetTemplatePath($sName,$sPluginName=null) { if ($sPluginName) { $sPluginName = preg_match('/^Plugin([\w]+)(_[\w]+)?$/Ui',$sPluginName,$aMatches) ? strtolower($aMatches[1]) : strtolower($sPluginName); - + $sLangDir=Plugin::GetTemplatePath($sPluginName).'notify/'.$this->Lang_GetLang(); if(is_dir($sLangDir)) { return $sLangDir.'/'.$sName; diff --git a/classes/modules/user/mapper/User.mapper.class.php b/classes/modules/user/mapper/User.mapper.class.php index bf9a796b..aad44dcb 100644 --- a/classes/modules/user/mapper/User.mapper.class.php +++ b/classes/modules/user/mapper/User.mapper.class.php @@ -51,6 +51,7 @@ class ModuleUser_MapperUser extends Mapper { user_rating = ? , user_count_vote = ? , user_activate = ? , + user_activate_key = ? , user_profile_name = ? , user_profile_sex = ? , user_profile_country = ? , @@ -76,6 +77,7 @@ class ModuleUser_MapperUser extends Mapper { $oUser->getRating(), $oUser->getCountVote(), $oUser->getActivate(), + $oUser->getActivateKey(), $oUser->getProfileName(), $oUser->getProfileSex(), $oUser->getProfileCountry(), @@ -676,8 +678,8 @@ class ModuleUser_MapperUser extends Mapper { public function getUserFieldValueByName($iUserId, $sName) { $sql = 'SELECT value FROM '.Config::Get('db.table.user_field_value').' WHERE - user_id = ?d - AND + user_id = ?d + AND field_id = (SELECT id FROM '.Config::Get('db.table.user_field').' WHERE name =?)'; $ret = $this->oDb->selectCol($sql, $iUserId, $sName); return $ret[0]; diff --git a/engine/lib/internal/template/js/user.js b/engine/lib/internal/template/js/user.js index dac2be82..2cf52358 100644 --- a/engine/lib/internal/template/js/user.js +++ b/engine/lib/internal/template/js/user.js @@ -24,9 +24,9 @@ ls.user = (function ($) { } else { var url = aRouter.profile+'ajaxfriendadd/'; } - + var params = {idUser: idUser, userText: sText}; - + ls.hook.marker('addFriendBefore'); ls.ajax(url, params, function(result){ $('#add_friend_form').children().each(function(i, item){$(item).removeAttr('disabled')}); @@ -52,7 +52,7 @@ ls.user = (function ($) { this.removeFriend = function(obj,idUser,sAction) { var url = aRouter.profile+'ajaxfrienddelete/'; var params = {idUser: idUser,sAction: sAction}; - + ls.hook.marker('removeFriendBefore'); ls.ajax(url, params, function(result) { if (result.bStateError) { @@ -423,6 +423,35 @@ ls.user = (function ($) { }); }; + /** + * Ajax запрос на ссылку активации + * @param form + */ + this.reminder = function(form) { + var url = aRouter.login+'ajax-reactivation/'; + + ls.hook.marker('reactivationBefore'); + ls.ajaxSubmit(url, form, function(result) { + if (typeof(form)=='string') { + form=$('#'+form); + } + form.find('.validate-error-show').removeClass('validate-error-show').addClass('validate-error-hide'); + + if (result.bStateError) { + form.find('.validate-error-reactivation').removeClass('validate-error-hide').addClass('validate-error-show').text(result.sMsg); + } else { + form.find('input').val(''); + if (result.sMsg) { + ls.msg.notice(null,result.sMsg); + } + if (result.sUrlRedirect) { + window.location=result.sUrlRedirect; + } + ls.hook.run('ls_user_reactivation_after', [form, result]); + } + }); + }; + /** * Поиск пользователей */ @@ -475,13 +504,13 @@ ls.user = (function ($) { * Подписка */ this.followToggle = function(obj, iUserId) { - if ($(obj).hasClass('followed')) { + if ($(obj).hasClass('followed')) { ls.stream.unsubscribe(iUserId); $(obj).toggleClass('followed').text(ls.lang.get('profile_user_follow')); - } else { + } else { ls.stream.subscribe(iUserId); $(obj).toggleClass('followed').text(ls.lang.get('profile_user_unfollow')); - } + } return false; }; diff --git a/templates/language/english.php b/templates/language/english.php index c39ee20c..ea7d67e5 100644 --- a/templates/language/english.php +++ b/templates/language/english.php @@ -412,6 +412,7 @@ return array( 'user_login_submit' => 'Login', 'user_login_remember' => 'Remember me', 'user_login_bad' => 'Something is wrong! Wrong login (e-mail) or password?.', + 'user_not_activated' => 'You have not activated your account.
Re-activation request', 'user_password' => 'Password', 'user_password_reminder' => 'Password reminder', 'user_exit_notice' => 'Please come again.', @@ -499,6 +500,12 @@ return array( 'registration_captcha_error' => 'Wrong code', 'registration_submit' => 'Submit registration', 'registration_ok' => 'Congratulation with successful registration!', + /** + * Re-activation + */ + "reactivation" => "Re-activation request", + "reactivation_submit" => "Get a link to the activation", + "reactivation_send_link" => "Activation link is sent to your e-mail.", /** * Vote for users */ @@ -959,6 +966,7 @@ return array( 'notify_subject_reminder_password' => 'New password', 'notify_subject_wall_reply' => 'You\'ve recieved reply to your post on wall', 'notify_subject_wall_new' => 'You\'ve recieved new post on your wall', + 'notify_subject_reactvation' => 'Re-activation request', /** * Админка */ diff --git a/templates/language/russian.php b/templates/language/russian.php index f61532a1..e9d38833 100644 --- a/templates/language/russian.php +++ b/templates/language/russian.php @@ -412,6 +412,7 @@ return array( 'user_login_submit' => 'Войти', 'user_login_remember' => 'Запомнить меня', 'user_login_bad' => 'Что-то не так! Вероятно, неправильно указан логин (e-mail) или пароль.', + 'user_not_activated' => 'Вы не активировали вашу учетную запись.
Повторный запрос активации', 'user_password' => 'Пароль', 'user_password_reminder' => 'Напомнить пароль', 'user_exit_notice' => 'Обязательно приходите еще.', @@ -499,6 +500,14 @@ return array( 'registration_captcha_error' => 'Неверный код', 'registration_submit' => 'Зарегистрироваться', 'registration_ok' => 'Поздравляем! Регистрация прошла успешно', + + /** + * Повторный запрос активации + */ + "reactivation" => "Повторный запрос активации", + "reactivation_submit" => "Получить ссылку на активацию", + "reactivation_send_link" => "Ссылка для активации отправлена на ваш адрес электронной почты.", + /** * Голосование за пользователя */ @@ -959,6 +968,7 @@ return array( 'notify_subject_reminder_password' => 'Новый пароль', 'notify_subject_wall_reply' => 'Ответ на ваше сообщение на стене', 'notify_subject_wall_new' => 'Новое сообщение на вашей стене', + 'notify_subject_reactvation' => 'Повторный запрос активации', /** * Админка */ diff --git a/templates/skin/synio/actions/ActionLogin/reactivation.tpl b/templates/skin/synio/actions/ActionLogin/reactivation.tpl new file mode 100644 index 00000000..51329931 --- /dev/null +++ b/templates/skin/synio/actions/ActionLogin/reactivation.tpl @@ -0,0 +1,26 @@ +{assign var="noSidebar" value=true} +{include file='header.tpl'} + + + + + +
+

+ +

+ + +
+ + + +{include file='footer.tpl'} \ No newline at end of file diff --git a/templates/skin/synio/notify/english/notify.reactivation.tpl b/templates/skin/synio/notify/english/notify.reactivation.tpl new file mode 100644 index 00000000..23e32bc4 --- /dev/null +++ b/templates/skin/synio/notify/english/notify.reactivation.tpl @@ -0,0 +1,7 @@ +You have requested re-activation on the site {cfg name='view.name'}
+ +Link to the account activation: +{router page='registration'}activate/{$oUser->getActivateKey()}/ + +

+Best regards, site administration {cfg name='view.name'} \ No newline at end of file diff --git a/templates/skin/synio/notify/russian/notify.reactivation.tpl b/templates/skin/synio/notify/russian/notify.reactivation.tpl new file mode 100644 index 00000000..d86395c1 --- /dev/null +++ b/templates/skin/synio/notify/russian/notify.reactivation.tpl @@ -0,0 +1,7 @@ +Вы запросили повторную активацию на сайте {cfg name='view.name'}
+ +Ссылка на активацию аккаунта: +{router page='registration'}activate/{$oUser->getActivateKey()}/ + +

+С уважением, администрация сайта {cfg name='view.name'} \ No newline at end of file