Attached Files |
email_activation_registration_439.patch [^] (57,003 bytes) 2012-03-21 11:22
[Show Content]
Index: core/admin_templates/login.tpl
===================================================================
--- core/admin_templates/login.tpl (revision 3249)
+++ core/admin_templates/login.tpl (working copy)
@@ -1,7 +1,7 @@
<inp2:m_include t="incs/header" nobody="yes" noform="yes"/>
<inp2:m_Set skip_last_template="1"/>
-<body style="margin: 0px 8px 0px 8px; background-color: #fff;" text="#000000" style="height: 100%;" onLoad="document.getElementById($form_name).login.focus();">
+<body style="margin: 0px 8px 0px 8px; background-color: #fff;" text="#000000" style="height: 100%;" onLoad="document.getElementById('login').focus();">
<table border="0" cellspacing="0" cellpadding="0" style="width: 100%; height: 90%;">
<tr>
@@ -26,16 +26,16 @@
<table cellpadding="4" cellspacing="0" border="0">
<tr bgcolor="#F0F0F0">
<td class="text"><inp2:m_phrase name="la_Text_Login"/></td>
- <td><input type="text" name="login" class="text" onkeypress="catchHotKeysA(event);"></td>
+ <td><input type="text" id="login" name="<inp2:u.login-admin_InputName name='UserLogin'/>" class="text" value="<inp2:u.login-admin_CookieUsername field='UserLogin'/>"></td>
</tr>
<tr bgcolor="#F0F0F0">
<td class="text"><inp2:m_phrase name="la_prompt_Password"/></td>
- <td><input type="password" name="password" class="text" onKeyPress="catchHotKeysA(event);"></td>
+ <td><input type="password" name="<inp2:u.login-admin_InputName name='UserPassword'/>" class="text"></td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="2">
<div align="left">
- <input type="submit" name="login_button" onclick="doLogin();" value="<inp2:m_phrase name="la_Login"/>" class="button">
+ <input type="submit" name="login_button" value="<inp2:m_phrase name="la_Login"/>" class="button">
<input type="reset" name="cancel_button" value="<inp2:m_phrase name="la_Cancel"/>" class="button">
</div>
</td>
@@ -44,28 +44,26 @@
</td>
</tr>
</table>
- <inp2:m_if check="u.current_HasError" field="any">
- <p class="error"><inp2:u.current_Error field="ValidateLogin"/></p>
+
+ <inp2:m_if check="u.login-admin_HasError" field="any">
+ <p class="error"><inp2:u.login-admin_Error field="UserLogin"/></p>
</inp2:m_if>
</td>
</tr>
</table>
<input type="hidden" name="next_template" value="<inp2:m_if check="m_GetEquals" name="next_template" value="">index<inp2:m_else/><inp2:m_get var="next_template"/></inp2:m_if>">
<input type="hidden" name="skip_last_template" value="1"/>
-
+
<script type="text/javascript">
- function doLogin()
- {
- submit_event('u', 'OnLogin');
- }
+ var a_parent = window.parent;
- function catchHotKeysA(e)
- {
- if (!e) return;
- if (e.keyCode == 13) doLogin();
- }
+ $(document).ready(
+ function() {
+ $("#login").focus();
+ Application.SetVar('events[u.login-admin]', 'OnLogin');
+ }
+ );
- var a_parent = window.parent;
function redirect()
{
window.name = 'redirect';
Index: core/kernel/constants.php
===================================================================
--- core/kernel/constants.php (revision 3249)
+++ core/kernel/constants.php (working copy)
@@ -94,4 +94,10 @@
// place for product file uploads (sort of "/system/images" but for all other files)
define('ITEM_FILES_PATH', (defined('WRITEBALE_BASE') ? WRITEBALE_BASE : '/kernel') . '/downloads/');
+
+ define('LOGIN_RESULT_OK', 0);
+ define('LOGIN_RESULT_INVALID_LOGIN', 1);
+ define('LOGIN_RESULT_INVALID_PASSWORD', 2);
+ define('LOGIN_RESULT_BANNED', 3);
+ define('LOGIN_RESULT_NO_PERMISSION', 4);
?>
\ No newline at end of file
Index: core/kernel/startup.php
===================================================================
--- core/kernel/startup.php (revision 3249)
+++ core/kernel/startup.php (working copy)
@@ -150,5 +150,8 @@
define ('KG_TO_POUND', 2.20462262);
define ('POUND_TO_KG', 0.45359237);
+ // system users
+ define('USER_ROOT', -1);
+ define('USER_GUEST', -2);
?>
\ No newline at end of file
Index: core/units/general/helpers/helpers_config.php
===================================================================
--- core/units/general/helpers/helpers_config.php (revision 3249)
+++ core/units/general/helpers/helpers_config.php (working copy)
@@ -29,5 +29,7 @@
Array('pseudo'=>'RatingHelper','class'=>'RatingHelper','file'=>'rating_helper.php','build_event'=>'','require_classes'=>'kHelper'),
Array('pseudo'=>'FCKHelper','class'=>'fckFCKHelper','file'=>'fck_helper.php','build_event'=>'','require_classes'=>'kHelper'),
Array('pseudo' => 'SpamHelper', 'class' => 'SpamHelper','file' => 'spam_helper.php', 'build_event' => '', 'require_classes' => Array('kHelper')),
+
+ Array ('pseudo' => 'UserHelper', 'class' => 'UserHelper', 'file' => 'user_helper.php', 'build_event' => '', 'require_classes' => Array('kHelper')),
),
);
\ No newline at end of file
Index: core/units/general/helpers/user_helper.php
===================================================================
--- core/units/general/helpers/user_helper.php (revision 0)
+++ core/units/general/helpers/user_helper.php (revision 0)
@@ -0,0 +1,446 @@
+<?php
+/**
+* @version $Id: user_helper.php 14516 2011-09-03 14:38:13Z alex $
+* @package In-Portal
+* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
+* @license GNU/GPL
+* In-Portal is Open Source software.
+* This means that this software may have been modified pursuant
+* the GNU General Public License, and as distributed it includes
+* or is derivative of works licensed under the GNU General Public License
+* or other free or open source software licenses.
+* See http://www.in-portal.org/license for copyright notices and details.
+*/
+
+ defined('FULL_PATH') or die('restricted access!');
+
+ class UserHelper extends kHelper {
+
+ /**
+ * Event to be used during login processings
+ *
+ * @var kEvent
+ */
+ var $event = null;
+
+ /**
+ * Performs user login and returns the result
+ *
+ * @param string $username
+ * @param string $password
+ * @param bool $dry_run
+ * @param bool $remember_login
+ * @param string $remember_login_cookie
+ * @return int
+ */
+ function loginUser($username, $password, $dry_run = false, $remember_login = false, $remember_login_cookie = '')
+ {
+ if (!isset($this->event)) {
+ $this->event = new kEvent('u:OnLogin');
+ }
+
+ if (!$password && !$remember_login_cookie) {
+ return LOGIN_RESULT_INVALID_PASSWORD;
+ }
+
+ $object =& $this->getUserObject();
+
+ // process "Save Username" checkbox
+ if ($this->Application->IsAdmin()) {
+ $save_username = $this->Application->GetVar('cb_save_username') ? $username : '';
+ $this->Application->Session->SetCookie('save_username', $save_username, strtotime('+1 year'));
+
+ // cookie will be set on next refresh, but refresh won't occur if
+ // login error present, so duplicate cookie in kHTTPQuery
+ $this->Application->SetVar('save_username', $save_username);
+ }
+
+ // logging in "root" (admin only)
+ $super_admin = ($username == 'super-root') && $this->verifySuperAdmin();
+ if ($this->Application->IsAdmin() && ($username == 'root') || ($super_admin && $username == 'super-root')) {
+ $root_password = $this->Application->ConfigValue('RootPass');
+ $password_formatter =& $this->Application->recallObject('kPasswordFormatter');
+
+ if ($root_password != $password_formatter->EncryptPassword($password, 'b38')) {
+ return LOGIN_RESULT_INVALID_PASSWORD;
+ }
+
+ $user_id = USER_ROOT;
+ $object->Clear($user_id);
+ $object->SetDBField('Login', 'root');
+
+ if (!$dry_run) {
+ $this->loginUserById($user_id, $remember_login_cookie);
+
+ if ($super_admin) {
+ $this->Application->StoreVar('super_admin', 1);
+ }
+
+ // reset counters
+ $this->Application->resetCounters('UserSession');
+
+ $this->_processLoginRedirect('root', $password);
+ $this->_processInterfaceLanguage();
+ }
+
+ return LOGIN_RESULT_OK;
+ }
+
+ $user_id = $this->getUserId($username, $password, $remember_login_cookie);
+
+ if ($user_id) {
+ $object->Load($user_id);
+
+ if (!$this->checkBanRules($object)) {
+ return LOGIN_RESULT_BANNED;
+ }
+
+ if ($object->GetDBField('Status') == STATUS_ACTIVE) {
+ if ( !$this->checkLoginPermission() ) {
+ return LOGIN_RESULT_NO_PERMISSION;
+ }
+
+ if (!$dry_run) {
+ $this->loginUserById($user_id, $remember_login_cookie);
+
+ if ($remember_login) {
+ // remember username & password when "Remember Login" checkbox us checked (when user is using login form on Front-End)
+ $this->Application->Session->SetCookie('remember_login', $username . '|' . md5($password), strtotime('+1 month'));
+ }
+
+ if (!$remember_login_cookie) {
+ // reset counters
+ $this->Application->resetCounters('UserSession');
+
+ $this->_processLoginRedirect($username, $password);
+ $this->_processInterfaceLanguage();
+ }
+ }
+
+ return LOGIN_RESULT_OK;
+ }
+ else {
+ $pending_template = $this->Application->GetVar('pending_disabled_template');
+
+ if ($pending_template !== false && !$dry_run) {
+ // when user found, but it's not yet approved redirect hit to notification template
+ $this->event->redirect = $pending_template;
+
+ return LOGIN_RESULT_OK;
+ }
+ else {
+ // when no notification template given return an error
+ return LOGIN_RESULT_INVALID_PASSWORD;
+ }
+ }
+ }
+
+ if (!$dry_run) {
+ $this->event->SetRedirectParam('pass', 'all');
+// $this->event->SetRedirectParam('pass_category', 1); // to test
+ }
+
+ return LOGIN_RESULT_INVALID_PASSWORD;
+ }
+
+ /**
+ * Login username by it's PortalUserId
+ *
+ * @param int $user_id
+ * @param bool $remember_login_cookie
+ */
+ function loginUserById($user_id, $remember_login_cookie = false)
+ {
+ $object =& $this->getUserObject();
+
+ $this->Application->StoreVar('user_id', $user_id);
+ $this->Application->SetVar('u.current_id', $user_id);
+ $this->Application->Session->SetField('PortalUserId', $user_id);
+
+ if ($user_id != USER_ROOT) {
+ $groups = $this->Application->RecallVar('UserGroups');
+ $this->Application->Session->SetField('GroupId', reset( explode(',', $groups) ));
+ $this->Application->Session->SetField('GroupList', $groups);
+ }
+
+ $this->Application->LoadPersistentVars();
+
+ if (!$remember_login_cookie) {
+ // don't change last login time when auto-login is used
+ $this_login = (int)$this->Application->RecallPersistentVar('ThisLogin');
+ $this->Application->StorePersistentVar('LastLogin', $this_login);
+ $this->Application->StorePersistentVar('ThisLogin', adodb_mktime());
+ }
+
+ $this->Application->HandleEvent($dummy, 'u:OnAfterLogin');
+ }
+
+ /**
+ * Checks login permission
+ *
+ * @return bool
+ */
+ function checkLoginPermission()
+ {
+ $object =& $this->getUserObject();
+
+ $groups = $object->getMembershipGroups(true);
+ if (!$groups) {
+ $groups = Array();
+ }
+
+ // store groups, because kApplication::CheckPermission will use them!
+ array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') );
+ $this->Application->StoreVar( 'UserGroups', implode(',', $groups), true ); // true for optional
+
+ return $this->Application->CheckPermission($this->Application->IsAdmin() ? 'ADMIN' : 'LOGIN', 1);
+ }
+
+ /**
+ * Performs user logout
+ *
+ */
+ function logoutUser()
+ {
+ if (!isset($this->event)) {
+ $this->event = new kEvent('u:OnLogout');
+ }
+
+ $sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
+ $sync_manager->performAction('LogoutUser');
+
+ $this->Application->HandleEvent($dummy, 'u:OnBeforeLogout');
+
+ $user_id = USER_GUEST;
+ $this->Application->SetVar('u.current_id', $user_id);
+ $object =& $this->Application->recallObject('u.current', null, Array('skip_autoload' => true));
+ $object->Load($user_id);
+
+ $this->Application->DestroySession();
+
+ $this->Application->StoreVar('user_id', $user_id, true);
+ $this->Application->Session->SetField('PortalUserId', $user_id);
+
+ $group_list = $this->Application->ConfigValue('User_GuestGroup') . ',' . $this->Application->ConfigValue('User_LoggedInGroup');
+ $this->Application->StoreVar('UserGroups', $group_list, true);
+ $this->Application->Session->SetField('GroupList', $group_list);
+
+ if ($this->Application->ConfigValue('UseJSRedirect')) {
+ $this->event->SetRedirectParam('js_redirect', 1);
+ }
+
+ $this->Application->resetCounters('UserSession');
+ $this->Application->Session->SetCookie('remember_login', '', strtotime('-1 hour'));
+
+ // don't pass user prefix on logout, since resulting url will have broken "env"
+ $this->event->SetRedirectParam('pass', MOD_REWRITE ? 'm' : 'all');
+ }
+
+ /**
+ * Returns user id based on given criteria
+ *
+ * @param string $username
+ * @param string $password
+ * @param string $remember_login_cookie
+ * @return int
+ */
+ function getUserId($username, $password, $remember_login_cookie)
+ {
+ $password = md5($password);
+
+ if ($remember_login_cookie) {
+ list ($username, $password) = explode('|', $remember_login_cookie); // 0 - username, 1 - md5(password)
+ }
+
+ $sql = 'SELECT PortalUserId
+ FROM ' . TABLE_PREFIX . 'PortalUser
+ WHERE (Email = %1$s OR Login = %1$s) AND (Password = %2$s)';
+ return $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($username), $this->Conn->qstr($password) ) );
+ }
+
+ /**
+ * Process all required data and redirect logged-in user
+ *
+ * @param string $username
+ * @param string $password
+ */
+ function _processLoginRedirect($username, $password)
+ {
+ // set next template
+ $next_template = $this->Application->GetVar('next_template');
+
+ if ($next_template) {
+ $this->event->redirect = $next_template;
+ }
+
+ // process IIS redirect
+ if ($this->Application->ConfigValue('UseJSRedirect')) {
+ $this->event->SetRedirectParam('js_redirect', 1);
+ }
+
+ // syncronize login
+ $sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
+ $sync_manager->performAction('LoginUser', $username, $password);
+ }
+
+ /**
+ * Sets correct interface language after sucessful login, based on user settings
+ *
+ * @param kEvent $event
+ */
+ function _processInterfaceLanguage()
+ {
+ if (!$this->Application->IsAdmin()) {
+ return ;
+ }
+
+ $is_root = $this->Application->RecallVar('user_id') == USER_ROOT;
+
+ $object =& $this->getUserObject();
+
+ $user_language_id = $is_root ? $this->Application->RecallPersistentVar('AdminLanguage') : $object->GetDBField('AdminLanguage');
+
+ $sql = 'SELECT LanguageId, IF(LanguageId = ' . (int)$user_language_id . ', 2, AdminInterfaceLang) AS SortKey
+ FROM ' . TABLE_PREFIX . 'Language
+ WHERE Enabled = 1
+ HAVING SortKey <> 0
+ ORDER BY SortKey DESC';
+ $language_info = $this->Conn->GetRow($sql);
+ $language_id = $language_info && $language_info['LanguageId'] ? $language_info['LanguageId'] : $user_language_id;
+
+ if ($user_language_id != $language_id) {
+ // first admin login OR language was delelted or disabled
+ if ($is_root) {
+ $this->Application->StorePersistentVar('AdminLanguage', $language_id);
+ }
+ else {
+ $object->SetDBField('AdminLanguage', $language_id);
+ $object->Update();
+ }
+ }
+
+ $this->event->SetRedirectParam('m_lang', $language_id); // data
+ $this->Application->Session->SetField('Language', $language_id); // interface
+ }
+
+ /**
+ * Checks that user is allowed to use super admin mode
+ *
+ * @return bool
+ */
+ function verifySuperAdmin()
+ {
+ $sa_mode = ipMatch(defined('SA_IP') ? SA_IP : '');
+ return $sa_mode || $this->Application->isDebugMode();
+ }
+
+ /**
+ * Returns user object, used during login processings
+ *
+ * @return UsersItem
+ */
+ function &getUserObject()
+ {
+ $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme
+ $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true));
+
+ return $object;
+ }
+
+ /**
+ * Checks, if given user fields matches at least one of defined ban rules
+ *
+ * @param kDBItem $object
+ * @return bool
+ */
+ function checkBanRules(&$object)
+ {
+ $table = $this->Application->getUnitOption('ban-rule', 'TableName');
+
+ if (!$this->Conn->TableFound($table)) {
+ // when ban table not found -> assume user is ok by default
+ return true;
+ }
+
+ $sql = 'SELECT *
+ FROM ' . $table . '
+ WHERE ItemType = 6 AND Status = ' . STATUS_ACTIVE . '
+ ORDER BY Priority DESC';
+ $rules = $this->Conn->Query($sql);
+
+ $found = false;
+
+ foreach ($rules as $rule) {
+ $field = $rule['ItemField'];
+ $this_value = mb_strtolower( $object->GetDBField($field) );
+ $test_value = mb_strtolower( $rule['ItemValue'] );
+
+ switch ( $rule['ItemVerb'] ) {
+ case 1: // is
+ if ($this_value == $test_value) {
+ $found = true;
+ }
+ break;
+
+ case 2: // is not
+ if ($this_value != $test_value) {
+ $found = true;
+ }
+ break;
+
+ case 3: // contains
+ if ( strstr($this_value, $test_value) ) {
+ $found = true;
+ }
+ break;
+
+ case 4: // not contains
+ if ( !strstr($this_value, $test_value) ) {
+ $found = true;
+ }
+ break;
+
+ case 7: // exists
+ if ( strlen($this_value) > 0 ) {
+ $found = true;
+ }
+ break;
+
+ case 8: // unique
+ if ( $this->_checkValueExist($field, $this_value) ) {
+ $found = true;
+ }
+ break;
+ }
+
+ if ( $found ) {
+ // check ban rules, until one of them matches
+
+ if ( $rule['RuleType'] ) {
+ // invert rule type
+ $found = false;
+ }
+
+ break;
+ }
+ }
+
+ return !$found;
+ }
+
+ /**
+ * Checks if value is unique in Users table against the specified field
+ *
+ * @param string $field
+ * @param string $value
+ * @return string
+ */
+ function _checkValueExist($field, $value)
+ {
+ $sql = 'SELECT *
+ FROM ' . $this->Application->getUnitOption('u', 'TableName') . '
+ WHERE '. $field .' = ' . $this->Conn->qstr($value);
+
+ return $this->Conn->GetOne($sql);
+ }
+ }
Index: core/units/logs/session_logs/session_logs_config.php
===================================================================
--- core/units/logs/session_logs/session_logs_config.php (revision 3249)
+++ core/units/logs/session_logs/session_logs_config.php (working copy)
@@ -9,6 +9,30 @@
'AutoLoad' => true,
+ 'Hooks' => Array (
+ Array (
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'u',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnAfterLogin'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnStartSession',
+ ),
+
+ Array (
+ 'Mode' => hAFTER,
+ 'Conditional' => false,
+ 'HookToPrefix' => 'u',
+ 'HookToSpecial' => '*',
+ 'HookToEvent' => Array ('OnBeforeLogout'),
+ 'DoPrefix' => '',
+ 'DoSpecial' => '*',
+ 'DoEvent' => 'OnEndSession',
+ ),
+ ),
+
'QueryString' => Array (
1 => 'id',
2 => 'Page',
Index: core/units/users/users_config.php
===================================================================
--- core/units/users/users_config.php (revision 3249)
+++ core/units/users/users_config.php (working copy)
@@ -267,6 +267,17 @@
'formatter' => 'kOptionsFormatter', 'options_sql' => 'SELECT %1$s FROM ' . TABLE_PREFIX . 'PortalGroup WHERE Enabled = 1 AND FrontRegistration = 1', 'option_key_field' => 'GroupId', 'option_title_field' => 'Name',
'not_null' => 1, 'default' => 0,
),
+
+ // for login form
+ 'UserLogin' => Array (
+ 'type' => 'string',
+ 'error_msgs' => Array (
+ 'no_permission' => '!la_no_permissions!', 'invalid_password' => '!la_invalid_password!'
+ ),
+ 'default' => ''
+ ),
+ 'UserPassword' => Array ('type' => 'string', 'default' => ''),
+ 'UserRememberLogin' => Array ('type' => 'int', 'default' => 0),
),
'Grids' => Array(
Index: core/units/users/users_event_handler.php
===================================================================
--- core/units/users/users_event_handler.php (revision 3249)
+++ core/units/users/users_event_handler.php (working copy)
@@ -157,152 +157,28 @@
/**
* Checks user data and logs it in if allowed
*
- * OnLogin is called from u:autoLoginUser and password is supplied
- * OnLogin is called from u:OnAutoLoginUser supplying cookie with encoded username & password
- *
* @param kEvent $event
*/
function OnLogin(&$event)
{
- // persistent session data after login is not refreshed, because redirect will follow in any case
- $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme
- $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true));
- $password = $this->Application->GetVar('password');
+ $object =& $event->getObject();
+ /* @var $object kDBItem */
- $invalid_pseudo = $this->Application->IsAdmin() ? 'la_invalid_password' : 'lu_invalid_password';
- $remember_login_cookie = $this->Application->GetVar('remember_login');
+ $object->SetFieldsFromHash( $this->getSubmittedFields($event) );
+ $username = $object->GetDBField('UserLogin');
+ $password = $object->GetDBField('UserPassword');
+ $rember_login = $object->GetDBField('UserRememberLogin') == 1;
- if (!$password && !$remember_login_cookie) {
- $object->SetError('ValidateLogin', 'invalid_password', $invalid_pseudo);
- $event->status = erFAIL;
- return false;
- }
+ $user_helper =& $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
- $email_as_login = $this->Application->ConfigValue('Email_As_Login');
- list ($login_field, $submit_field) = $email_as_login && !$this->Application->IsAdmin() ? Array('Email', 'email') : Array('Login', 'login');
- $login_value = $this->Application->GetVar($submit_field);
+ $user_helper->event =& $event;
+ $result = $user_helper->loginUser($username, $password, false, $rember_login);
- // process "Save Username" checkbox
- if ($this->Application->IsAdmin()) {
- $save_username = $this->Application->GetVar('cb_save_username') ? $login_value : '';
- $this->Application->Session->SetCookie('save_username', $save_username, adodb_mktime() + 31104000); // 1 year expiration
- $this->Application->SetVar('save_username', $save_username); // cookie will be set on next refresh, but refresh won't occur if login error present, so duplicate cookie in HTTPQuery
- }
-
- $super_admin = ($login_value == 'super-root') && $this->verifySuperAdmin();
- if ($this->Application->IsAdmin() && ($login_value == 'root') || ($super_admin && $login_value == 'super-root')) {
- // logging in "root" (admin only)
-
- $login_value = 'root';
-
- $root_password = $this->Application->ConfigValue('RootPass');
- $password_formatter =& $this->Application->recallObject('kPasswordFormatter');
- $test = $password_formatter->EncryptPassword($password, 'b38');
- if ($root_password != $test) {
- $object->SetError('ValidateLogin', 'invalid_password', $invalid_pseudo);
- $event->status = erFAIL;
- return false;
- }
- elseif ($this->checkLoginPermission($login_value)) {
- $user_id = -1;
- $object->Load($user_id);
- $object->SetDBField('Login', $login_value);
-
- $session =& $this->Application->recallObject('Session');
- $session->SetField('PortalUserId', $user_id);
-// $session->SetField('GroupList', implode(',', $groups) );
- $this->Application->SetVar('u.current_id', $user_id);
- $this->Application->StoreVar('user_id', $user_id);
-
- if ($super_admin) {
- $this->Application->StoreVar('super_admin', 1);
- }
-
- $this->Application->HandleEvent($dummy, 'session-log:OnStartSession');
- $this->processLoginRedirect($event, $password);
- return true;
- }
- else {
- $object->SetError('ValidateLogin', 'invalid_license', 'la_invalid_license');
- $event->status = erFAIL;
- return false;
- }
- }
-
- /*$sql = 'SELECT PortalUserId FROM '.$object->TableName.' WHERE (%s = %s) AND (Password = MD5(%s))';
- $user_id = $this->Conn->GetOne( sprintf($sql, $login_field, $this->Conn->qstr($login_value), $this->Conn->qstr($password) ) );*/
-
- if ($remember_login_cookie) {
- $user_info = explode('|', $remember_login_cookie); // 0 - username, 1 - md5(password)
-
- $sql = 'SELECT PortalUserId
- FROM '.$object->TableName.'
- WHERE (Email = %1$s OR Login = %1$s) AND (Password = %2$s)';
- $user_id = $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($user_info[0]), $this->Conn->qstr($user_info[1]) ) );
- } else {
- $sql = 'SELECT PortalUserId
- FROM '.$object->TableName.'
- WHERE (Email = %1$s OR Login = %1$s) AND (Password = MD5(%2$s))';
- $user_id = $this->Conn->GetOne( sprintf($sql, $this->Conn->qstr($login_value), $this->Conn->qstr($password) ) );
- }
-
- if ($user_id) {
- $object->Load($user_id);
- if (!$this->checkBanRules($object)) {
- $event->status = erFAIL;
- return false;
- }
- if ($object->GetDBField('Status') == STATUS_ACTIVE) {
- $groups = $object->getMembershipGroups(true);
- if(!$groups) $groups = Array();
- array_push($groups, $this->Application->ConfigValue('User_LoggedInGroup') );
- $this->Application->StoreVar( 'UserGroups', implode(',', $groups) );
-
- if ($this->checkLoginPermission($login_value)) {
- $session =& $this->Application->recallObject('Session');
- $session->SetField('PortalUserId', $user_id);
- $session->SetField('GroupList', implode(',', $groups) );
- $this->Application->SetVar('u.current_id', $user_id);
- $this->Application->StoreVar('user_id', $user_id);
-
- $this->Application->LoadPersistentVars();
-
- if (!$remember_login_cookie) {
- // don't change last login time when auto-login is used
- $this_login = (int)$this->Application->RecallPersistentVar('ThisLogin');
- $this->Application->StorePersistentVar('LastLogin', $this_login);
- $this->Application->StorePersistentVar('ThisLogin', adodb_mktime());
- }
-
- if ($this->Application->GetVar('cb_remember_login') == 1) {
- // remember username & password when "Remember Login" checkbox us checked (when user is using login form on Front-End)
- $remember_login_cookie = $login_value . '|' . md5($password);
- $this->Application->Session->SetCookie('remember_login', $remember_login_cookie, adodb_mktime() + 2592000); // 30 days
- }
- }
- else {
- $object->Load(-2);
- $object->SetError('ValidateLogin', 'no_permission', 'lu_no_permissions');
- $event->status = erFAIL;
- }
-
- if (!$remember_login_cookie) {
- $this->processLoginRedirect($event, $password);
- }
- }
- else {
- $event->redirect = $this->Application->GetVar('pending_disabled_template');
- }
- }
- else
- {
- $object->SetID(-2);
- $object->SetError('ValidateLogin', 'invalid_password', $invalid_pseudo);
+ if ($result != LOGIN_RESULT_OK) {
$event->status = erFAIL;
+ $object->SetError('UserLogin', $result == LOGIN_RESULT_NO_PERMISSION ? 'no_permission' : 'invalid_password');
}
-
- $event->SetRedirectParam('pass', 'all');
-// $event->SetRedirectParam('pass_category', 1); // to test
}
/**
@@ -318,84 +194,13 @@
return ;
}
- $event->CallSubEvent('OnLogin');
- }
+ $user_helper =& $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
- /**
- * Checks that user is allowed to use super admin mode
- *
- * @return bool
- */
- function verifySuperAdmin()
- {
- $sa_mode = ipMatch(defined('SA_IP') ? SA_IP : '');
- return $sa_mode || $this->Application->isDebugMode();
+ $user_helper->loginUser('', '', false, false, $remember_login_cookie);
}
/**
- * Enter description here...
- *
- * @param string $user_name
- * @return bool
- */
- function checkLoginPermission($user_name)
- {
- $ret = true;
- if ($this->Application->IsAdmin()) {
- $modules_helper =& $this->Application->recallObject('ModulesHelper');
- if ($user_name != 'root') {
- // root is virtual user, so allow him to login to admin in any case
- $ret = $this->Application->CheckPermission('ADMIN', 1);
- }
- $ret = $ret && $modules_helper->checkLogin();
- }
- else {
- $ret = $this->Application->CheckPermission('LOGIN', 1);
- }
- return $ret;
- }
-
- /**
- * Process all required data and redirect logged-in user
- *
- * @param kEvent $event
- */
- function processLoginRedirect(&$event, $password)
- {
- $prefix_special = $this->Application->IsAdmin() ? 'u.current' : 'u'; // "u" used on front not to change theme
- $object =& $this->Application->recallObject($prefix_special, null, Array('skip_autoload' => true));
-
- $next_template = $this->Application->GetVar('next_template');
- if ($next_template == '_ses_redirect') {
- $location = $this->Application->BaseURL().$this->Application->RecallVar($next_template);
- if( $this->Application->isDebugMode() && constOn('DBG_REDIRECT') )
- {
- $this->Application->Debugger->appendTrace();
- echo "<b>Debug output above!!!</b> Proceed to redirect: <a href=\"$location\">$location</a><br>";
- }
- else {
- header('Location: '.$location);
- }
-
- $session =& $this->Application->recallObject('Session');
- $session->SaveData();
- exit;
- }
-
- if ($next_template) {
- $event->redirect = $next_template;
- }
-
- if ($this->Application->ConfigValue('UseJSRedirect')) {
- $event->SetRedirectParam('js_redirect', 1);
- }
-
- $sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
- $sync_manager->performAction('LoginUser', $object->GetDBField('Login'), $password);
- $this->Application->resetCounters('UserSession');
- }
-
- /**
* Called when user logs in using old in-portal
*
* @param kEvent $event
@@ -424,32 +229,11 @@
function OnLogout(&$event)
{
- $sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');
- $sync_manager->performAction('LogoutUser');
+ $user_helper =& $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
- $this->Application->HandleEvent($dummy, 'session-log:OnEndSession');
-
- $session =& $this->Application->recallObject('Session');
- $session->SetField('PortalUserId', -2);
- $this->Application->SetVar('u.current_id', -2);
- $this->Application->StoreVar('user_id', -2);
- $object =& $this->Application->recallObject('u.current', null, Array('skip_autoload' => true));
- $object->Load(-2);
-
- $this->Application->DestroySession();
-
- $group_list = $this->Application->ConfigValue('User_GuestGroup').','.$this->Application->ConfigValue('User_LoggedInGroup');
- $session->SetField('GroupList', $group_list);
- $this->Application->StoreVar('UserGroups', $group_list);
-
- if ($this->Application->ConfigValue('UseJSRedirect')) {
- $event->SetRedirectParam('js_redirect', 1);
- }
-
- $this->Application->resetCounters('UserSession');
- $this->Application->Session->SetCookie('remember_login', '', adodb_mktime() - 3600);
-
- $event->SetRedirectParam('pass', 'all');
+ $user_helper->event =& $event;
+ $user_helper->logoutUser();
}
/**
@@ -539,21 +323,18 @@
function autoLoginUser(&$event)
{
$object =& $event->getObject();
- $this->Application->SetVar('u.current_id', $object->GetID() );
+ $this->Application->SetVar('u.current_id', $object->GetID());
- if($object->GetDBField('Status') == STATUS_ACTIVE && !$this->Application->ConfigValue('User_Password_Auto'))
- {
- $email_as_login = $this->Application->ConfigValue('Email_As_Login');
- list($login_field, $submit_field) = $email_as_login ? Array('Email', 'email') : Array('Login', 'login');
+ if ( $object->GetDBField('Status') == STATUS_ACTIVE ) {
+ $user_helper =& $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
- $this->Application->SetVar($submit_field, $object->GetDBField($login_field) );
- $this->Application->SetVar('password', $object->GetDBField('Password_plain') );
-
- $event->CallSubEvent('OnLogin');
+ if ( $user_helper->checkLoginPermission() ) {
+ $user_helper->loginUserById( $object->GetID() );
+ }
}
}
-
/**
* When creating user & user with such email exists then force to use OnUpdate insted of ?
*
@@ -675,6 +456,7 @@
break;
case 3: // Pending
+ case 4: // Email Activation
$next_template = $this->Application->GetVar('registration_confirm_pending_template');
if($next_template) $event->redirect = $next_template;
$object->SetDBField('Status', 2);
@@ -705,15 +487,21 @@
$this->_makePasswordRequired($event);
$email_as_login = $this->Application->ConfigValue('Email_As_Login');
+
$object =& $event->getObject();
- if (!$this->checkBanRules($object)) {
+ /* @var $object kDBItem */
+
+ $user_helper =& $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
+
+ if ( !$user_helper->checkBanRules($object) ) {
$event->status = erFAIL;
return false;
}
- if ($email_as_login) {
+
+ if ( $email_as_login ) {
$object->Fields['Email']['error_msgs']['unique'] = $this->Application->Phrase('lu_user_and_email_already_exist');
}
-
}
/**
@@ -1203,6 +991,11 @@
*/
function getPassedID(&$event)
{
+ if ( preg_match('/^(login|register|recommend|subscribe|forgot)/', $event->Special) ) {
+ // this way we can have 2+ objects stating with same special, e.g. "u.login-sidebox" and "u.login-main"
+ return USER_GUEST;
+ }
+
switch ($event->Special) {
case 'ord':
$order =& $this->Application->recallObject('ord');
@@ -1723,96 +1516,6 @@
}
/**
- * Checks, if given user fields matches at least one of defined ban rules
- *
- * @param kDBItem $object
- * @return bool
- */
- function checkBanRules(&$object)
- {
- $table = $this->Application->getUnitOption('ban-rule', 'TableName');
- if (!$this->Conn->TableFound($table)) {
- // when ban table not found -> assume user is ok by default
- return true;
- }
-
- $sql = 'SELECT *
- FROM '.$table.'
- WHERE ItemType = 6 AND Status = ' . STATUS_ACTIVE . '
- ORDER BY Priority DESC';
- $rules = $this->Conn->Query($sql);
-
- $found = false;
- foreach ($rules as $rule) {
- $field = $rule['ItemField'];
-
- $this_value = strtolower( $object->GetDBField($field) );
- $test_value = strtolower( $rule['ItemValue'] );
-
- switch ($rule['ItemVerb']) {
- /*case 0: // any
- $found = true;
- break;*/
-
- case 1: // is
- if ($this_value == $test_value) {
- $found = true;
- }
- break;
-
- /*case 2: // is not
- if ($this_value != $test_value) {
- $found = true;
- }
- break;*/
-
- case 3: // contains
- if (strstr($this_value, $test_value)) {
- $found = true;
- }
- break;
-
-
- /*case 4: // not contains
- if (!strstr($this_value, $test_value)) {
- $found = true;
- }
- break;
-
- case 5: // Greater Than
- if ($test_value > $this_value) {
- $found = true;
- }
- break;
-
- case 6: // Less Than
- if ($test_value < $this_value) {
- $found = true;
- }
- break;
-
- case 7: // exists
- if (strlen($this_value) > 0) {
- $found = true;
- }
- break;
-
- case 8: // unique
- if ($this->ValueExists($field, $this_value)) {
- $found = true;
- }
- break;*/
- }
-
- if ($found) {
- break;
- }
- }
-
- return !$found;
- }
-
- /**
* Makes password required for new users
*
* @param kEvent $event
@@ -1855,6 +1558,26 @@
$object->setRequired($required_field);
}
}
+
+ /**
+ * Occurs just after login (for hooking)
+ *
+ * @param kEvent $event
+ */
+ function OnAfterLogin(&$event)
+ {
+
+ }
+
+ /**
+ * Occurs just before logout (for hooking)
+ *
+ * @param kEvent $event
+ */
+ function OnBeforeLogout(&$event)
+ {
+
+ }
}
?>
\ No newline at end of file
Index: core/units/users/users_tag_processor.php
===================================================================
--- core/units/users/users_tag_processor.php (revision 3249)
+++ core/units/users/users_tag_processor.php (working copy)
@@ -84,36 +84,72 @@
function TestCodeIsValid($params)
{
- $passed_key = trim($this->Application->GetVar('user_key'));
+ $passed_key = trim($this->Application->GetVar('user_key'));
- // used for error reporting only -> rewrite code + theme (by Alex)
- $user_current_object = &$this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too
+ // used for error reporting only -> rewrite code + theme (by Alex)
+ $user_current_object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too
/* @var $user_current_object UsersItem */
- if (!$passed_key) {
- $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', 'lu_code_is_not_valid');
+ $code_type = isset($params['code_type']) ? $params['code_type'] : 'forgot_password';
+
+ $error_messages = Array (
+ 'forgot_password' => Array (
+ 'code_is_not_valid' => 'lu_code_is_not_valid',
+ 'code_expired' => 'lu_code_expired',
+ ),
+
+ 'activation' => Array (
+ 'code_is_not_valid' => 'lu_error_ActivationCodeNotValid',
+ 'code_expired' => 'lu_error_ActivationCodeExpired',
+ ),
+ );
+
+ if ($code_type == 'custom') {
+ // custom error messages are given directly in tag
+ $error_messages[$code_type] = Array (
+ 'code_is_not_valid' => $params['error_invalid'],
+ 'code_expired' => $params['error_expired'],
+ );
+ }
+
+ $expiration_timeouts = Array (
+ 'forgot_password' => 'config:Users_AllowReset',
+ 'activation' => 'config:UserEmailActivationTimeout',
+ 'custom' => '',
+ );
+
+ if (!$passed_key) {
+ $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', $error_messages[$code_type]['code_is_not_valid']);
+
return false;
- }
+ }
- $user_object =& $this->Application->recallObject('u.forgot', null, Array('skip_autoload' => true));
- /* @var $user_object UsersItems */
+ $user_object =& $this->Application->recallObject('u.forgot', null, Array('skip_autoload' => true));
+ /* @var $user_object UsersItem */
- $user_object->Load($passed_key, 'PwResetConfirm');
+ $user_object->Load($passed_key, 'PwResetConfirm');
- if ($user_object->isLoaded()) {
- $expiration_time = $user_object->GetDBField('PwRequestTime') + 3600;
- if ($expiration_time > adodb_mktime()) {
- return true;
- } else {
- $user_current_object->SetError('PwResetConfirm', 'code_expired', 'lu_code_expired');
- return false;
- }
- }
- else {
- $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', 'lu_code_is_not_valid');
- return false;
- }
+ if ( !$user_object->isLoaded() ) {
+ $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', $error_messages[$code_type]['code_is_not_valid']);
+ return false;
+ }
+ else {
+ $expiration_timeout = isset($params['expiration_timeout']) ? $params['expiration_timeout'] : $expiration_timeouts[$code_type];
+
+ if ( preg_match('/^config:(.*)$/', $expiration_timeout, $regs) ) {
+ $expiration_timeout = $this->Application->ConfigValue( $regs[1] );
+ }
+
+ if ( $expiration_timeout ) {
+ if ( $user_object->GetDBField('PwRequestTime') < strtotime('-' . $expiration_timeout . ' minutes') ) {
+ $user_current_object->SetError('PwResetConfirm', 'code_expired', $error_messages[$code_type]['code_expired']);
+
+ return false;
+ }
+ }
+ }
+
return true;
}
@@ -180,9 +216,10 @@
function CookieUsername($params)
{
- $submit_value = $this->Application->GetVar($params['submit_field']);
- if ($submit_value !== false) {
- return $submit_value;
+ $items_info = $this->Application->GetVar( $this->getPrefixSpecial(true) );
+
+ if ( $items_info !== false ) {
+ return $items_info[USER_GUEST][ $params['field'] ];
}
$username = $this->Application->GetVar('save_username'); // from cookie
@@ -190,6 +227,7 @@
if ($username == 'super-root') {
$username = 'root';
}
+
return $username === false ? '' : $username;
}
@@ -244,6 +282,60 @@
return isset($loggedin_status[$this->Special][$object->GetID()]);
}
+
+ /**
+ * Prints user activation link
+ *
+ * @param Array $params
+ * @return string
+ */
+ function ActivationLink($params)
+ {
+ $code = $this->getCachedCode();
+
+ $fields_hash = Array (
+ 'PwResetConfirm' => $code,
+ 'PwRequestTime' => adodb_mktime(),
+ );
+
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $this->Conn->doUpdate($fields_hash, $object->TableName, $object->IDField . ' = ' . $object->GetID());
+
+ $params['user_key'] = $code;
+
+ return $this->Application->ProcessParsedTag('m', 'Link', $params);
+ }
+
+ /**
+ * Activates user using given code
+ *
+ * @param Array $params
+ */
+ function ActivateUser($params)
+ {
+ $passed_key = trim($this->Application->GetVar('user_key'));
+
+ $user_helper =& $this->Application->recallObject('UserHelper');
+ /* @var $user_helper UserHelper */
+
+ $user =& $user_helper->getUserObject();
+ $user->Load($passed_key, 'PwResetConfirm');
+
+ if ( !$user->isLoaded() ) {
+ return ;
+ }
+
+ $user->SetDBField('Status', STATUS_ACTIVE);
+ $user->SetDBField('PwResetConfirm', '');
+ $user->SetDBField('PwRequestTime', 0);
+ $user->Update();
+
+ if ( $user_helper->checkLoginPermission() ) {
+ $user_helper->loginUserById( $user->GetID() );
+ }
+ }
}
?>
\ No newline at end of file
Index: core/units/visits/visits_config.php
===================================================================
--- core/units/visits/visits_config.php (revision 3249)
+++ core/units/visits/visits_config.php (working copy)
@@ -32,7 +32,7 @@
'Conditional' => false,
'HookToPrefix' => 'u',
'HookToSpecial' => '*',
- 'HookToEvent' => Array( 'OnLogin' ),
+ 'HookToEvent' => Array( 'OnAfterLogin' ),
'DoPrefix' => '',
'DoSpecial' => '',
'DoEvent' => 'OnUserLogin',
Index: custom/install/english.lang
===================================================================
--- custom/install/english.lang (revision 3249)
+++ custom/install/english.lang (working copy)
@@ -13,6 +13,7 @@
<PHRASE Label="la_col_TravelGuideType" Module="Custom" Type="1">VHJhdmVsIEd1aWRlIFR5cGU=</PHRASE>
<PHRASE Label="la_col_Visibility" Module="Custom" Type="1">VmlzaWJpbGl0eQ==</PHRASE>
<PHRASE Label="la_config_DenyFriendshipAfterDays" Module="Custom" Type="1">QXV0b21hdGljYWxseSBkZW55IHVuY29uZmlybWVkIFRyYXZlbCBCdWRkeSByZXF1ZXN0cyBhZnRlciBOIGRheXM=</PHRASE>
+ <PHRASE Label="la_config_UserEmailActivationTimeout" Module="Custom" Type="1">RW1haWwgYWN0aXZhdGlvbiBleHBpcmF0aW9uIHRpbWVvdXQgKGluIG1pbnV0ZXMp</PHRASE>
<PHRASE Label="la_CustomProperties" Module="Custom" Type="1">Q3VzdG9tIFByb3BlcnRpZXM=</PHRASE>
<PHRASE Label="la_event_album.photo.added" Module="Custom" Type="1">TmV3IGFsYnVtIHBob3RvIGFkZGVk</PHRASE>
<PHRASE Label="la_event_banner.expiration.reminer" Module="Custom" Type="1">QmFubmVyIEV4cGlyYXRpb24gUmVtaW5kZXI=</PHRASE>
@@ -39,6 +40,7 @@
<PHRASE Label="la_opt_Listing" Module="Custom" Type="1">TGlzdGluZw==</PHRASE>
<PHRASE Label="la_opt_Nobody" Module="Custom" Type="1">Tm9ib2R5</PHRASE>
<PHRASE Label="la_opt_TravelGuide" Module="Custom" Type="1">VHJhdmVsIEd1aWRl</PHRASE>
+ <PHRASE Label="la_opt_UserEmailActivation" Module="Custom" Type="1">RW1haWwgQWN0aXZhdGlvbg==</PHRASE>
<PHRASE Label="la_opt_UserLocal" Module="Custom" Type="1">SSBhbSBhIGxvY2Fs</PHRASE>
<PHRASE Label="la_opt_UserVisitor" Module="Custom" Type="1">SSBhbSB2aXNpdG9y</PHRASE>
<PHRASE Label="la_section_ActivityType" Module="Custom" Type="1">Q2F0ZWdvcnkgQWN0aXZpdHkgVHlwZQ==</PHRASE>
@@ -77,6 +79,7 @@
<PHRASE Label="lu_btn_AddNote" Module="Custom" Type="0">QWRkIE5vdGU=</PHRASE>
<PHRASE Label="lu_btn_AddPhoto" Module="Custom" Type="0">QWRkIFBob3Rv</PHRASE>
<PHRASE Label="lu_btn_AddPhotos" Module="Custom" Type="0">QWRkIFBob3Rvcw==</PHRASE>
+ <PHRASE Label="lu_btn_AddYourPhotos" Module="Custom" Type="0">VXBsb2FkIFlvdXIgUGhvdG9z</PHRASE>
<PHRASE Label="lu_btn_MakePrimary" Module="Custom" Type="0">TWFrZSBQcmltYXJ5</PHRASE>
<PHRASE Label="lu_btn_ManagePhotos" Module="Custom" Type="0">TWFuYWdlIFBob3Rvcw==</PHRASE>
<PHRASE Label="lu_btn_ResetFilters" Module="Custom" Type="0">UmVzZXQgRmlsdGVycw==</PHRASE>
@@ -99,6 +102,7 @@
<PHRASE Label="lu_fld_Image7" Module="Custom" Type="0">OHRoIEltYWdl</PHRASE>
<PHRASE Label="lu_fld_Image8" Module="Custom" Type="0">OXRoIEltYWdl</PHRASE>
<PHRASE Label="lu_fld_Image9" Module="Custom" Type="0">MTB0aCBJbWFnZQ==</PHRASE>
+ <PHRASE Label="lu_fld_Images" Module="Custom" Type="0">SW1hZ2Vz</PHRASE>
<PHRASE Label="lu_fld_LinkFeature" Module="Custom" Type="1">TGluayBGZWF0dXJl</PHRASE>
<PHRASE Label="lu_fld_ModifiedOn" Module="Custom" Type="0">TW9kaWZpZWQgT24=</PHRASE>
<PHRASE Label="lu_fld_MyAverageRating" Module="Custom" Type="0">TXkgQXZlcmFnZSBSYXRpbmc=</PHRASE>
Index: custom/install/install_data.sql
===================================================================
--- custom/install/install_data.sql (revision 3249)
+++ custom/install/install_data.sql (working copy)
@@ -60,3 +60,12 @@
# place here only sql queries, that were executed on prod server !!!
+UPDATE `tt_ConfigurationAdmin`
+SET `ValueList` = '1=la_User_Instant,2=la_User_Not_Allowed,3=la_User_Upon_Approval,4=la_opt_UserEmailActivation'
+WHERE `VariableName` = 'User_Allow_New';
+
+# set User_Allow_New variable value to "E-mail Activation"
+# copy translation (subject, body) of USER.ADD.PENDING user type e-mail event
+
+INSERT INTO tt_ConfigurationAdmin VALUES ('UserEmailActivationTimeout', 'la_Text_General', 'la_config_UserEmailActivationTimeout', 'text', NULL, NULL, 10.051, 0, 0);
+INSERT INTO tt_ConfigurationValues VALUES (DEFAULT, 'UserEmailActivationTimeout', '', 'In-Portal:Users', 'in-portal:configure_users');
Index: custom/units/album_photos/album_photo_eh.php
===================================================================
--- custom/units/album_photos/album_photo_eh.php (revision 3252)
+++ custom/units/album_photos/album_photo_eh.php (working copy)
@@ -495,7 +495,7 @@
{
$sql = 'SELECT Title, PhotoAlbumId
FROM ' . TABLE_PREFIX . 'PhotoAlbums
- WHERE CreatedById = ' . $this->Application->RecallVar('user_id') . ' AND Title <> ' . $this->Conn->qstr(HIDDEN_ALBUM) . '
+ WHERE CreatedById = ' . (int)$this->Application->RecallVar('user_id') . ' AND Title <> ' . $this->Conn->qstr(HIDDEN_ALBUM) . '
ORDER BY Title ASC';
$albums = $this->Conn->GetCol($sql, 'PhotoAlbumId');
Index: themes/theme_triptutor.com/platform/elements/side_boxes/login.tpl
===================================================================
--- themes/theme_triptutor.com/platform/elements/side_boxes/login.tpl (revision 3249)
+++ themes/theme_triptutor.com/platform/elements/side_boxes/login.tpl (working copy)
@@ -87,33 +87,33 @@
<form method="post" action="<inp2:m_FormAction />">
<inp2:m_if check="u_UseUsernames">
<inp2:m_phrase label="lu_username"/><br />
- <input class="input-text" type="text" name="login" style="width:155px" /><br />
<inp2:m_else/>
<inp2:m_phrase label="lu_email"/><br />
- <input class="input-text" type="text" name="email" style="width:155px" /><br />
</inp2:m_if>
+ <input class="input-text" type="text" name="<inp2:u.login-sidebox_InputName name='UserLogin'/>" value="<inp2:u.login-sidebox_Field name='UserLogin'/>" style="width:155px" /><br />
+
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" width="1" height="5" alt=""/><br />
<inp2:m_Phrase label="lu_Password"/><br />
- <input type="password" class="input-text" name="password" style="width:155px" /><br />
+ <input type="password" class="input-text" name="<inp2:u.login-sidebox_InputName name='UserPassword'/>" value="<inp2:u.login-sidebox_Field name='UserPassword'/>" style="width:155px" /><br />
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="1" height="10" border="0" /><br />
<table>
<tr>
<td width="10">
- <input class="button" name="events[u][OnLogin]" type="submit" value="<inp2:m_Phrase label="lu_Login"/>" /><br />
+ <input class="button" name="events[u.login-sidebox][OnLogin]" type="submit" value="<inp2:m_Phrase label="lu_Login"/>" /><br />
</td>
<td align="left">
- <input type="checkbox" name="cb_remember_login" value="1"/> <span class="remember-login"><inp2:m_Phrase label="lu_remember_login"/></span>
+ <input type="checkbox" name="<inp2:u.login-sidebox_InputName name='UserRememberLogin'/>" id="<inp2:u.login-sidebox_InputName name='UserRememberLogin'/>" value="1"/> <label for="<inp2:u.login-sidebox_InputName name='UserRememberLogin'/>" class="remember-login"><inp2:m_Phrase label="lu_remember_login"/></label>
</td>
</tr>
</table>
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/s.gif" alt="" width="5" height="5" border="0" /><br />
- <inp2:m_if check="u_HasError" field="any">
- <span class="field-error"><inp2:u_Error field="ValidateLogin"/></span><br />
+ <inp2:m_if check="u.login-sidebox_HasError" field="any">
+ <span class="field-error"><inp2:u.login-sidebox_Error field="UserLogin"/></span><br />
</inp2:m_if>
<inp2:m_if check="u_RegistrationEnabled">
Index: themes/theme_triptutor.com/platform/login/activate_confirm.tpl
===================================================================
--- themes/theme_triptutor.com/platform/login/activate_confirm.tpl (revision 0)
+++ themes/theme_triptutor.com/platform/login/activate_confirm.tpl (revision 0)
@@ -0,0 +1,53 @@
+<!--##
+<NAME>Registration Activation</NAME>
+<DESC></DESC>
+<SECTION>My Account||Login</SECTION>
+##-->
+
+<!--## PAGE TITLE ELEMENT ##-->
+<inp2:m_DefineElement name="page_title">
+ <inp2:m_phrase name="lu_title_RegistrationConfirmation" no_editing="1"/>
+</inp2:m_DefineElement>
+<!--## //PAGE TITLE ELEMENT ##-->
+
+<!--## SIDE-BAR ELEMENT ##-->
+<inp2:m_DefineElement name="sidebar">
+ <inp2:m_RenderElements
+ elements="
+ platform/elements/side_boxes/search,
+ platform/elements/side_boxes/mailing_list,
+ "
+ design="blue_box"/>
+</inp2:m_DefineElement>
+<!--## //SIDE-BAR ELEMENT ##-->
+
+<inp2:m_DefineElement name="content">
+ <div class="movable-area">
+ <div class="movable-element">
+ <inp2:m_include template="platform/elements/navigation_bar" titles="lu_title_UserRegistration,lu_title_RegistrationConfirmation" templates="platform/login/register,platform/login/register_confirm_pending"/>
+ </div>
+ <div class="movable-element">
+ <!-- registration confirmation -->
+ <inp2:m_RenderElement design="content_box">
+ <inp2:m_Capture to_var="header">
+ <inp2:m_phrase name="lu_title_RegistrationConfirmation"/>
+ </inp2:m_Capture>
+
+ <inp2:m_if check="u_TestCodeIsValid" code_type="activation">
+ <inp2:u_ActivateUser/>
+ <inp2:m_Phrase name="lu_RegistrationCompleted"/>
+
+ <br /><br />
+ <input type="button" value="<inp2:m_Phrase label='lu_btn_Ok'/>" class="button" onclick="redirect('<inp2:m_Link template='index' m_cat_id='0' m_cat_page='1'/>');"/>
+ <inp2:m_else />
+ <span class="field-error"><inp2:u_Error field="PwResetConfirm"/></span>
+ <br /><br />
+ <a href="<inp2:m_Link template='index' m_cat_id='0' m_cat_page='1'/>"><inp2:m_Phrase label="lu_ReturnToHome"/></a>
+ </inp2:m_if>
+ </inp2:m_RenderElement>
+ <!-- // registration confirmation -->
+ </div>
+ </div>
+</inp2:m_DefineElement>
+
+<inp2:m_include template="platform/designs/default_design" pass_params="1"/>
\ No newline at end of file
Index: themes/theme_triptutor.com/platform/login/register.tpl
===================================================================
--- themes/theme_triptutor.com/platform/login/register.tpl (revision 3266)
+++ themes/theme_triptutor.com/platform/login/register.tpl (working copy)
@@ -30,47 +30,39 @@
<form method="post" action="<inp2:m_FormAction/>" name="login_register" id="login_register">
<img src="<inp2:m_TemplatesBase module="In-Portal"/>img/grey_pix.gif" width="100%" height="1" align="absmiddle" alt="" />
<table class="form-data fullwidth">
-
- <inp2:m_if check="u_HasError" field="ValidateLogin">
+ <inp2:m_if check="u.login-main_HasError" field="any">
<td class="field-name" nowrap colspan="2">
- <div ><span class="field-error"><inp2:u_Error field="ValidateLogin"/></span><br /></div>
+ <div ><span class="field-error"><inp2:u.login-main_Error field="UserLogin"/></span><br /></div>
</td>
</inp2:m_if>
- <inp2:m_if check="u_UseUsernames">
<tr>
<td class="field-name" nowrap>
- <label for="email"><span ><inp2:m_phrase label="lu_Username"/></span>:</label>
- </td>
- <td class="field-value">
- <input type="text" class="input-text" name="login" style="width:255px;">
- </td>
- </tr>
+ <inp2:m_if check="u_UseUsernames">
+ <span><inp2:m_phrase label="lu_Username"/></span>:
<inp2:m_else/>
- <tr>
- <td class="field-name" nowrap>
- <label for="email"><span ><inp2:m_phrase label="lu_Email"/></span>:</label>
+ <span><inp2:m_phrase label="lu_Email"/></span>:
+ </inp2:m_if>
</td>
<td class="field-value">
- <input type="text" class="input-text" name="email" style="width:255px;">
+ <input class="input-text" type="text" name="<inp2:u.login-main_InputName name='UserLogin'/>" value="<inp2:u.login-main_Field name='UserLogin'/>" style="width:255px" />
</td>
</tr>
- </inp2:m_if>
<inp2:m_RenderElement name="inp_edit_field_separator" is_last="0"/>
<tr>
<td class="field-name" nowrap>
- <label for="email"><span ><inp2:m_phrase label="lu_Password"/></span>:</label>
+ <span><inp2:m_phrase label="lu_Password"/></span>:
</td>
<td class="field-value">
- <input type="password" class="input-text" name="password" style="width:255px;">
+ <input type="password" class="input-text" name="<inp2:u.login-main_InputName name='UserPassword'/>" value="<inp2:u.login-main_Field name='UserPassword'/>" style="width:255px" />
</td>
</tr>
<inp2:m_RenderElement name="inp_edit_field_separator" is_last="0"/>
<inp2:m_RenderElement design="inp_edit_buttons">
<div style="float:left">
- <input class="button" name="events[u][OnLogin]" type="submit" value="<inp2:m_Phrase label="lu_Login"/>" style="width:101px;"/>
+ <input class="button" name="events[u.login-main][OnLogin]" type="submit" value="<inp2:m_Phrase label="lu_Login"/>" style="width:101px;"/>
<input type="button" class="button" onclick="history.back();" value="<inp2:m_Phrase name="lu_btn_Cancel"/>" style="width:101px;" />
<input type="hidden" name="next_template" value="<inp2:m_if check="m_get" var="next_template"><inp2:m_get var="next_template"/><inp2:m_else/>platform/my_account/my_account</inp2:m_if>" />
<input type="hidden" name="pending_disabled_template" value="platform/login/login_pending_disabled" />
email_activation_501.patch [^] (19,998 bytes) 2012-03-21 11:25
[Show Content]
Index: themes/default2009/platform/login/register_confirm_pending.tpl
===================================================================
--- themes/default2009/platform/login/register_confirm_pending.tpl (revision 12158)
+++ themes/default2009/platform/login/register_confirm_pending.tpl (revision 12159)
@@ -41,7 +41,12 @@
<inp2:m_phrase name="lu_title_RegistrationPendingConfirmation"/>
</inp2:m_Capture>
- <inp2:m_phrase name="lu_text_RegistrationPending"/>
+ <inp2:m_if check="m_GetConfig" name="User_Allow_New" equals_to="4">
+ <inp2:m_Phrase name="lu_text_RegistrationActivationPending"/>
+ <inp2:m_else/>
+ <inp2:m_Phrase name="lu_text_RegistrationPending"/>
+ </inp2:m_if>
+
</inp2:m_RenderElement>
<!-- // registration pending confirmation -->
</div>
Index: themes/default2009/platform/login/activate_confirm.tpl
===================================================================
--- themes/default2009/platform/login/activate_confirm.tpl (revision 0)
+++ themes/default2009/platform/login/activate_confirm.tpl (revision 12159)
@@ -0,0 +1,61 @@
+<!--##
+<NAME>Registration Activation</NAME>
+<DESC></DESC>
+<SECTION>My Account||Login</SECTION>
+##-->
+
+<!--## PAGE TITLE ELEMENT ##-->
+<inp2:m_DefineElement name="page_title">
+ <inp2:m_phrase name="lu_title_RegistrationConfirmation"/>
+</inp2:m_DefineElement>
+<!--## //PAGE TITLE ELEMENT ##-->
+
+<!--## SIDE-BAR ELEMENT ##-->
+<inp2:m_DefineElement name="sidebar">
+ <div class="movable-area">
+ <div class="movable-element">
+ <inp2:m_RenderElement name="platform/elements/side_boxes/login.elm" design="blue_box"/>
+ </div>
+ <div class="movable-element">
+ <inp2:m_RenderElement name="platform/elements/side_boxes/search.elm" design="blue_box"/>
+ </div>
+ <div class="movable-element">
+ <inp2:m_RenderElement name="platform/elements/side_boxes/recommend_site.elm" design="blue_box"/>
+ </div>
+ <div class="movable-element">
+ <inp2:m_RenderElement name="platform/elements/side_boxes/mailing_list.elm" design="blue_box"/>
+ </div>
+ </div>
+</inp2:m_DefineElement>
+<!--## //SIDE-BAR ELEMENT ##-->
+
+<inp2:m_DefineElement name="content">
+ <div class="movable-area">
+ <div class="movable-element">
+ <inp2:m_include template="platform/elements/navigation_bar.elm" titles="lu_title_UserRegistration,lu_title_RegistrationConfirmation" templates="platform/login/register,platform/login/register_confirm_pending"/>
+ </div>
+ <div class="movable-element">
+ <!-- registration confirmation -->
+ <inp2:m_RenderElement design="content_box">
+ <inp2:m_Capture to_var="header">
+ <inp2:m_phrase name="lu_title_RegistrationConfirmation"/>
+ </inp2:m_Capture>
+
+ <inp2:m_if check="u_TestCodeIsValid" code_type="activation">
+ <inp2:u_ActivateUser/>
+ <inp2:m_Phrase name="lu_RegistrationCompleted"/>
+
+ <br /><br />
+ <input type="button" value="<inp2:m_Phrase label='lu_btn_Ok'/>" class="button" onclick="redirect('<inp2:m_Link template='index' m_cat_id='0' m_cat_page='1'/>');"/>
+ <inp2:m_else />
+ <span class="field-error"><inp2:u_Error field="PwResetConfirm"/></span>
+ <br /><br />
+ <a href="<inp2:m_Link template='index' m_cat_id='0' m_cat_page='1'/>"><inp2:m_Phrase label="lu_ReturnToHome"/></a>
+ </inp2:m_if>
+ </inp2:m_RenderElement>
+ <!-- // registration confirmation -->
+ </div>
+ </div>
+</inp2:m_DefineElement>
+
+<inp2:m_include template="platform/designs/default_design.des" pass_params="1"/>
\ No newline at end of file
Index: core/kernel/constants.php
===================================================================
--- core/kernel/constants.php (revision 12158)
+++ core/kernel/constants.php (revision 12159)
@@ -29,10 +29,10 @@
define('FLT_TYPE_OR', 'OR');
// item statuses
- safeDefine('STATUS_DISABLED', 0);
- safeDefine('STATUS_ACTIVE', 1);
- safeDefine('STATUS_PENDING', 2);
- safeDefine('STATUS_PENDING_EDITING', -2);
+ define('STATUS_DISABLED', 0);
+ define('STATUS_ACTIVE', 1);
+ define('STATUS_PENDING', 2);
+ define('STATUS_PENDING_EDITING', -2);
// sections
define('stTREE', 1);
Index: core/units/users/users_tag_processor.php
===================================================================
--- core/units/users/users_tag_processor.php (revision 12158)
+++ core/units/users/users_tag_processor.php (revision 12159)
@@ -99,11 +99,26 @@
$passed_key = trim($this->Application->GetVar('user_key'));
// used for error reporting only -> rewrite code + theme (by Alex)
- $user_current_object = &$this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too
+ $user_current_object =& $this->Application->recallObject('u', null, Array('skip_autoload' => true)); // TODO: change theme too
/* @var $user_current_object UsersItem */
+ $code_type = array_key_exists('code_type', $params) ? $params['code_type'] : 'forgot_password';
+
+ $error_messages = Array (
+ 'forgot_password' => Array (
+ 'code_is_not_valid' => 'lu_code_is_not_valid',
+ 'code_expired' => 'lu_code_expired',
+ ),
+
+ 'activation' => Array (
+ 'code_is_not_valid' => 'lu_error_ActivationCodeNotValid',
+ 'code_expired' => 'lu_error_ActivationCodeExpired',
+ ),
+ );
+
+
if (!$passed_key) {
- $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', 'lu_code_is_not_valid');
+ $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', $error_messages[$code_type]['code_is_not_valid']);
return false;
}
@@ -117,12 +132,12 @@
if ($expiration_time > adodb_mktime()) {
return true;
} else {
- $user_current_object->SetError('PwResetConfirm', 'code_expired', 'lu_code_expired');
+ $user_current_object->SetError('PwResetConfirm', 'code_expired', $error_messages[$code_type]['code_expired']);
return false;
}
}
else {
- $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', 'lu_code_is_not_valid');
+ $user_current_object->SetError('PwResetConfirm', 'code_is_not_valid', $error_messages[$code_type]['code_is_not_valid']);
return false;
}
@@ -256,6 +271,54 @@
return isset($loggedin_status[$this->Special][$object->GetID()]);
}
+
+ /**
+ * Prints user activation link
+ *
+ * @param Array $params
+ * @return string
+ */
+ function ActivationLink($params)
+ {
+ $code = $this->getCachedCode();
+
+ $fields_hash = Array (
+ 'PwResetConfirm' => $code,
+ 'PwRequestTime' => adodb_mktime(),
+ );
+
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
+
+ $this->Conn->doUpdate($fields_hash, $object->TableName, $object->IDField . ' = ' . $object->GetID());
+
+ $params['user_key'] = $code;
+
+ return $this->Application->ProcessParsedTag('m', 'Link', $params);
+ }
+
+ /**
+ * Activates user using given code
+ *
+ * @param Array $params
+ */
+ function ActivateUser($params)
+ {
+ $passed_key = trim($this->Application->GetVar('user_key'));
+
+ $user =& $this->Application->recallObject('u', null, Array('skip_autoload' => true));
+ /* @var $user UsersItem */
+
+ $user->Load($passed_key, 'PwResetConfirm');
+ if (!$user->isLoaded()) {
+ return ;
+ }
+
+ $user->SetDBField('Status', STATUS_ACTIVE);
+ $user->SetDBField('PwResetConfirm', '');
+ $user->SetDBField('PwRequestTime', 0);
+ $user->Update();
+ }
}
?>
\ No newline at end of file
Index: core/units/users/users_event_handler.php
===================================================================
--- core/units/users/users_event_handler.php (revision 12158)
+++ core/units/users/users_event_handler.php (revision 12159)
@@ -687,37 +687,31 @@
$object =& $event->getObject( Array('skip_autoload' => true) );
$new_users_allowed = $this->Application->ConfigValue('User_Allow_New');
- // 1 - Instant, 2 - Not Allowed, 3 - Pending
- switch ($new_users_allowed)
- {
- case 1: // Instant
- $object->SetDBField('Status', 1);
+ switch ($new_users_allowed) {
+ case 1: // Immediate
+ $object->SetDBField('Status', STATUS_ACTIVE);
$next_template = $this->Application->GetVar('registration_confirm_template');
- if($next_template) $event->redirect = $next_template;
+ if ($next_template) {
+ $event->redirect = $next_template;
+ }
break;
- case 3: // Pending
+ case 3: // Upon Approval
+ case 4: // Email Activation
$next_template = $this->Application->GetVar('registration_confirm_pending_template');
- if($next_template) $event->redirect = $next_template;
- $object->SetDBField('Status', 2);
+ if ($next_template) {
+ $event->redirect = $next_template;
+ }
+ $object->SetDBField('Status', STATUS_PENDING);
break;
case 2: // Not Allowed
- $object->SetDBField('Status', 0);
+ $object->SetDBField('Status', STATUS_DISABLED);
break;
}
-
- /*if ($object->GetDBField('PaidMember') == 1) {
- $this->Application->HandleEvent($add_to_cart, 'ord:OnAddToCart');
- $event->redirect = 'in-commerce/checkout/shop_cart';
- } */
-
}
-
-
-
/**
* Set's new unique resource id to user
*
Index: core/units/users/users_item.php
===================================================================
--- core/units/users/users_item.php (revision 12158)
+++ core/units/users/users_item.php (revision 12159)
@@ -48,22 +48,16 @@
function SendEmailEvents()
{
- switch( $this->GetDBField('Status') )
- {
- case 1:
- if ($this->Application->ConfigValue('User_Password_Auto')) {
- $this->Application->EmailEventAdmin('USER.VALIDATE', $this->GetID() );
- $this->Application->EmailEventUser('USER.VALIDATE', $this->GetID() );
- }
- else {
- $this->Application->EmailEventAdmin('USER.ADD', $this->GetID() );
- $this->Application->EmailEventUser('USER.ADD', $this->GetID() );
- }
+ switch ($this->GetDBField('Status')) {
+ case STATUS_ACTIVE:
+ $event_name = $this->Application->ConfigValue('User_Password_Auto') ? 'USER.VALIDATE' : 'USER.ADD';
+ $this->Application->EmailEventAdmin($event_name, $this->GetID());
+ $this->Application->EmailEventUser($event_name, $this->GetID());
break;
- case 2:
- $this->Application->EmailEventAdmin('USER.ADD.PENDING', $this->GetID() );
- $this->Application->EmailEventUser('USER.ADD.PENDING', $this->GetID() );
+ case STATUS_PENDING:
+ $this->Application->EmailEventAdmin('USER.ADD.PENDING', $this->GetID());
+ $this->Application->EmailEventUser('USER.ADD.PENDING', $this->GetID());
break;
}
}
Index: core/install/upgrades.sql
===================================================================
--- core/install/upgrades.sql (revision 12158)
+++ core/install/upgrades.sql (revision 12159)
@@ -1368,4 +1368,11 @@
DELETE FROM Phrase WHERE Phrase IN ('la_fld_ImageId', 'la_fld_RelationshipId', 'la_fld_ReviewId', 'la_prompt_CensorhipId', 'my_account_title', 'Next Theme', 'Previous Theme', 'test 1', 'la_article_reviewed', 'la_configerror_review', 'la_link_reviewed', 'la_Prompt_ReviewedBy', 'la_prompt_ReviewId', 'la_prompt_ReviewText', 'la_reviewer', 'la_review_added', 'la_review_alreadyreviewed', 'la_review_error', 'la_tab_Editing_Review', 'la_tab_Review', 'la_ToolTip_New_Review', 'la_topic_reviewed', 'lu_add_review', 'lu_article_reviews', 'lu_ferror_review_duplicate', 'lu_link_addreview_confirm_pending_text', 'lu_link_reviews', 'lu_link_review_confirm', 'lu_link_review_confirm_pending', 'lu_link_addreview_confirm_text', 'lu_news_addreview_confirm_text', 'lu_news_addreview_confirm__pending_text', 'lu_news_review_confirm', 'lu_news_review_confirm_pending', 'lu_prompt_review', 'lu_reviews_updated', 'lu_review_access_denied', 'lu_review_article', 'lu_review_link', 'lu_review_news', 'lu_review_this_article', 'lu_fld_Review', 'lu_product_reviews', 'lu_ReviewProduct', ' lu_resetpw_confirm_text', 'lu_resetpw_confirm_text');
-UPDATE Modules SET Version = '5.0.0', Loaded = 1 WHERE Name = 'In-Portal';
\ No newline at end of file
+UPDATE Modules SET Version = '5.0.0', Loaded = 1 WHERE Name = 'In-Portal';
+
+# ===== v 5.0.1 =====
+UPDATE ConfigurationAdmin
+SET ValueList = '1=la_opt_UserInstantRegistration,2=la_opt_UserNotAllowedRegistration,3=la_opt_UserUponApprovalRegistration,4=la_opt_UserEmailActivation'
+WHERE VariableName = 'User_Allow_New';
+
+UPDATE Modules SET Version = '5.0.1', Loaded = 1 WHERE Name = 'In-Portal';
\ No newline at end of file
Index: core/install/english.lang
===================================================================
--- core/install/english.lang (revision 12158)
+++ core/install/english.lang (revision 12159)
@@ -893,6 +893,7 @@
<PHRASE Label="la_opt_Tab" Module="Core" Type="1">VGFi</PHRASE>
<PHRASE Label="la_opt_Title" Module="Core" Type="1">VGl0bGU=</PHRASE>
<PHRASE Label="la_opt_User" Module="Core" Type="1">VXNlcg==</PHRASE>
+ <PHRASE Label="la_opt_UserEmailActivation" Module="Core" Type="1">RW1haWwgQWN0aXZhdGlvbg==</PHRASE>
<PHRASE Label="la_opt_UserInstantRegistration" Module="Core" Type="1">SW1tZWRpYXRlIA==</PHRASE>
<PHRASE Label="la_opt_Username" Module="Core" Type="1">VXNlcm5hbWU=</PHRASE>
<PHRASE Label="la_opt_UserNotAllowedRegistration" Module="Core" Type="1">Tm90IEFsbG93ZWQ=</PHRASE>
@@ -1659,6 +1660,8 @@
<PHRASE Label="lu_ErrorAlreadyReviewed" Module="Core" Type="0">WW91IGhhdmUgYWxyZWFkeSBjb21tZW50ZWQgdGhpcyBpdGVtIQ==</PHRASE>
<PHRASE Label="lu_error_404_description" Module="Core" Type="0">U29ycnksIHRoZSByZXF1ZXN0ZWQgVVJMIHdhcyBub3QgZm91bmQgb24gb3VyIHNlcnZlci4=</PHRASE>
<PHRASE Label="lu_error_404_title" Module="Core" Type="0">RXJyb3IgNDA0IC0gTm90IEZvdW5k</PHRASE>
+ <PHRASE Label="lu_error_ActivationCodeExpired" Module="Core" Type="0">QWN0aXZhdGlvbiBjb2RlIGhhcyBleHBpcmVk</PHRASE>
+ <PHRASE Label="lu_error_ActivationCodeNotValid" Module="Core" Type="0">QWN0aXZhdGlvbiBjb2RlIGlzIG5vdCB2YWxpZA==</PHRASE>
<PHRASE Label="lu_error_alreadyadded" Module="Core" Type="0">Q2F0ZWdvcnkgYWxyZWFkeSBhZGRlZCE=</PHRASE>
<PHRASE Label="lu_error_AlreadyCommented" Module="Core" Type="0">QWxyZWFkeSBjb21tZW50ZWQ=</PHRASE>
<PHRASE Label="lu_error_categorylimitreached" Module="Core" Type="0">Q2F0ZWdvcnkgbGltaXQgcmVhY2hlZCE=</PHRASE>
@@ -1913,6 +1916,7 @@
<PHRASE Label="lu_text_NothingFound" Module="Core" Type="0">Tm90aGluZyBGb3VuZA==</PHRASE>
<PHRASE Label="lu_text_pagenotfound" Module="Core" Type="0">NDA0LiBQYWdlIG5vdCBmb3VuZCBvbiB0aGUgc2VydmVyLg==</PHRASE>
<PHRASE Label="lu_text_PasswordRequestConfirm" Module="Core" Type="0">UGxlYXNlIGNvbmZpcm0gdGhhdCB5b3Ugd2FudCB0byByZXNldCB5b3VyIHBhc3N3b3JkLg==</PHRASE>
+ <PHRASE Label="lu_text_RegistrationActivationPending" Module="Core" Type="0">VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91IGNhbiBhY3RpdmF0ZSB5b3VyIHJlZ2lzdHJhdGlvbiB1c2luZyBsaW5rIHNlbnQgdG8geW91IGJ5IGVtYWlsLg==</PHRASE>
<PHRASE Label="lu_text_registrationpending" Module="Core" Type="0">VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91ciByZWdpc3RyYXRpb24gaXMgcGVuZGluZyBhZG1pbmlzdHJhdGl2ZSBhcHByb3ZhbC4gWW91IHdpbGwgZ2V0IGEgc2VwYXJhdGUgZW1haWwgb25jZSBpdCdzIGFjdGl2YXRlZC4=</PHRASE>
<PHRASE Label="lu_text_suggestcategoryconfirm" Module="Core" Type="0">VGhhbmsgeW91IGZvciBzdWdnZXN0aW5nIHlvdXIgY2F0ZWdvcnku</PHRASE>
<PHRASE Label="lu_text_SuggestCategoryPendingConfirm" Module="Core" Type="0">U3VnZ2VzdGVkIGNhdGVnb3J5IGlzIHBlbmRpbmcgZm9yIEFkbWluaXN0cmF0aXZlIGFwcHJvdmFsIA==</PHRASE>
@@ -2010,7 +2014,7 @@
<EVENT MessageType="html" Event="FORM.SUBMITTED" Type="1">dGVzdApTdWJqZWN0OiBUaGFuayBZb3UgZm9yIENvbnRhY3RpbmcgVXMhCgo8cD5EZWFyICRmaXJzdG5hbWUhIDxiciAvPg0KVGhhbmsgeW91IGZvciBjb250YWN0aW5nIHVzITwvcD4=</EVENT>
<EVENT MessageType="text" Event="USER.ADD" Type="0">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IEluLXBvcnRhbCByZWdpc3RyYXRpb24KCkRlYXIgPGlucDI6dV9GaWVsZCBuYW1lPSJGaXJzdE5hbWUiIC8+IDxpbnAyOnVfRmllbGQgbmFtZT0iTGFzdE5hbWUiIC8+LA0KDQpUaGFuayB5b3UgZm9yIHJlZ2lzdGVyaW5nIG9uIDxpbnAyOm1fQmFzZVVybC8+LiBZb3VyIHJlZ2lzdHJhdGlvbiBpcyBub3cgYWN0aXZlLg==</EVENT>
<EVENT MessageType="text" Event="USER.ADD" Type="1">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IE5ldyB1c2VyIGhhcyBiZWVuIGFkZGVkCgpBIG5ldyB1c2VyICI8aW5wMjp1X0ZpZWxkIG5hbWU9IkxvZ2luIi8+IiBoYXMgYmVlbiBhZGRlZC4=</EVENT>
- <EVENT MessageType="text" Event="USER.ADD.PENDING" Type="0">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IEluLVBvcnRhbCBSZWdpc3RyYXRpb24KCkRlYXIgPGlucDI6dV9GaWVsZCBuYW1lPSJGaXJzdE5hbWUiIC8+IDxpbnAyOnVfRmllbGQgbmFtZT0iTGFzdE5hbWUiIC8+LA0KDQpUaGFuayB5b3UgZm9yIHJlZ2lzdGVyaW5nIG9uIDxpbnAyOm1fQmFzZVVybCAvPiB3ZWJzaXRlLiBZb3VyIHJlZ2lzdHJhdGlvbiB3aWxsIGJlIGFjdGl2ZSBhZnRlciBhcHByb3ZhbC4=</EVENT>
+ <EVENT MessageType="text" Event="USER.ADD.PENDING" Type="0">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IEluLVBvcnRhbCBSZWdpc3RyYXRpb24KCkRlYXIgPGlucDI6dV9GaWVsZCBuYW1lPSJGaXJzdE5hbWUiIC8+IDxpbnAyOnVfRmllbGQgbmFtZT0iTGFzdE5hbWUiIC8+LA0KDQo8aW5wMjptX2lmIGNoZWNrPSJtX0dldENvbmZpZyIgbmFtZT0iVXNlcl9BbGxvd19OZXciIGVxdWFsc190bz0iNCI+DQpUaGFuayB5b3UgZm9yIHJlZ2lzdGVyaW5nIG9uIDxpbnAyOm1fTGluayB0ZW1wbGF0ZT0iaW5kZXgiLz4gd2Vic2l0ZS4gVG8gYWN0aXZhdGUgeW91ciByZWdpc3RyYXRpb24gcGxlYXNlIGZvbGxvdyBsaW5rIGJlbG93Lg0KPGlucDI6dV9BY3RpdmF0aW9uTGluayB0ZW1wbGF0ZT0icGxhdGZvcm0vbG9naW4vYWN0aXZhdGVfY29uZmlybSIvPg0KPGlucDI6bV9lbHNlLz4NClRoYW5rIHlvdSBmb3IgcmVnaXN0ZXJpbmcgb24gPGlucDI6bV9MaW5rIHRlbXBsYXRlPSJpbmRleCIvPiB3ZWJzaXRlLiBZb3VyIHJlZ2lzdHJhdGlvbiB3aWxsIGJlIGFjdGl2ZSBhZnRlciBhcHByb3ZhbC4NCjwvaW5wMjptX2lmPg==</EVENT>
<EVENT MessageType="text" Event="USER.ADD.PENDING" Type="1">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IFVzZXIgcmVnaXN0ZXJlZAoKQSBuZXcgdXNlciAiPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiIgaGFzIHJlZ2lzdGVyZWQgYW5kIGlzIHBlbmRpbmcgYWRtaW5pc3RyYXRpdmUgYXBwcm92YWwu</EVENT>
<EVENT MessageType="text" Event="USER.APPROVE" Type="0">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IFlvdSBoYXZlIGJlZW4gYXBwcm92ZWQKCldlbGNvbWUgdG8gPGlucDI6bV9CYXNlVXJsLz4hDQoNCllvdXIgdXNlciByZWdpc3RyYXRpb24gaGFzIGJlZW4gYXBwcm92ZWQuIFlvdXIgdXNlciBuYW1lIGlzOiAiPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiIu</EVENT>
<EVENT MessageType="text" Event="USER.APPROVE" Type="1">WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IFVzZXIgYXBwcm92ZWQKClVzZXIgIjxpbnAyOnVfRmllbGQgbmFtZT0iTG9naW4iLz4iIGhhcyBiZWVuIGFwcHJvdmVkLg==</EVENT>
Index: core/install/install_data.sql
===================================================================
--- core/install/install_data.sql (revision 12158)
+++ core/install/install_data.sql (revision 12159)
@@ -158,7 +158,7 @@
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'CSVExportEncoding', '0', 'In-Portal', 'in-portal:configure_advanced');
# Section "in-portal:configure_users":
-INSERT INTO ConfigurationAdmin VALUES ('User_Allow_New', 'la_title_General', 'la_users_allow_new', 'radio', '', '1=la_opt_UserInstantRegistration,2=la_opt_UserNotAllowedRegistration,3=la_opt_UserUponApprovalRegistration', 10.01, 0, 1);
+INSERT INTO ConfigurationAdmin VALUES ('User_Allow_New', 'la_title_General', 'la_users_allow_new', 'radio', '', '1=la_opt_UserInstantRegistration,2=la_opt_UserNotAllowedRegistration,3=la_opt_UserUponApprovalRegistration,4=la_opt_UserEmailActivation', 10.01, 0, 1);
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'User_Allow_New', '3', 'In-Portal:Users', 'in-portal:configure_users');
INSERT INTO ConfigurationAdmin VALUES ('AdvancedUserManagement', 'la_title_General', 'la_prompt_AdvancedUserManagement', 'checkbox', NULL, NULL, 10.011, 0, 1);
INSERT INTO ConfigurationValues VALUES (DEFAULT, 'AdvancedUserManagement', 0, 'In-Portal:Users', 'in-portal:configure_users');
|