Index: install/english.lang =================================================================== --- install/english.lang (revision 14318) +++ install/english.lang (working copy) @@ -65,7 +65,7 @@ QWRkaXRpb25hbA== QWRtaW4gUHJpbWFyeQ== QWZmZWN0ZWQgSXRlbXM= - QWx0IFZhbHVl + QWx0IFZhbHVl QmNj Qm91bmNlZCBPbg== Qm91bmNlIEluZm8= @@ -189,7 +189,7 @@ UnVsZSBUeXBl UnVuIEludGVydmFs UnVuIE1vZGU= - U2VhcmNoIFRlcm0= + U2VhcmNoIFRlcm0= QXR0ZW1wdHMg U2VudCBPbg== U2VudA== @@ -291,6 +291,7 @@ RW5hYmxlIEhUTUwgR1pJUCBjb21wcmVzc2lvbg== VXNlIFBhZ2VIaXQgY291bnRlcg== RWRpdGluZyBXaW5kb3cgU3R5bGU= + RW1haWwgYWN0aXZhdGlvbiBleHBpcmF0aW9uIHRpbWVvdXQgKGluIG1pbnV0ZXMp VXNlIFNtYWxsIFNlY3Rpb24gSGVhZGVycw== Q29tcHJlc3MgQ29tcGlsZWQgUEhQIFRlbXBsYXRlcw== VXNlIFRvb2xiYXIgTGFiZWxz @@ -643,7 +644,7 @@ U3RhdGU= U3RhdGUgQ291bnRyeQ== U3RhdHVz - U3RvcCBXb3Jk + U3RvcCBXb3Jk U3ViamVjdA== U3VibWl0dGVkIE9u U3VnZ2VzdGVkIENvcnJlY3Rpb24= @@ -1013,7 +1014,7 @@ VXNlIG5vbi1ibG9ja2luZyBzb2NrZXQgbW9kZQ== U1FMIFF1ZXJ5Og== UGVyZm9ybSBTUUwgUXVlcnk= - U3RlcCBPbmU= + U3RlcCBPbmU= U3VibWl0dGVkIE9u RW5hYmxlIFRhZyBDYWNoaW5n VG90YWwgU2l6ZSBvZiBTeXN0ZW0gRmlsZXM= @@ -1168,7 +1169,7 @@ U2hvdyBBbGw= U2hvdyBTdHJ1Y3R1cmU= V2Vic2l0ZSAmIENvbnRlbnQ= - QWRtaW4gU2tpbnM= + QWRtaW4gU2tpbnM= U3VtbWFyeQ== Q29uZmlndXJhdGlvbg== VGFnIGxpYnJhcnk= @@ -1273,7 +1274,7 @@ QWRkaW5nIFBocmFzZQ== QWRkaW5nIEtleXdvcmQ= QWRkaW5nIFJlbGF0aW9uc2hpcA== - QWRkaW5nIENvbW1lbnQ= + QWRkaW5nIENvbW1lbnQ= QWRkaW5nIFRoZW1l QWRkaW5nIFVzZXI= QWRkaXRpb25hbCBQZXJtaXNzaW9ucw== @@ -1323,7 +1324,7 @@ RWRpdGluZyBQaHJhc2U= RWRpdGluZyBLZXl3b3Jk RWRpdGluZyBSZWxhdGlvbnNoaXA= - RWRpdGluZyBDb21tZW50 + RWRpdGluZyBDb21tZW50 RWRpdGluZyBUaGVtZQ== RWRpdGluZyBVc2Vy RS1tYWlsIENvbW11bmljYXRpb24= @@ -1362,7 +1363,7 @@ TmV3IEZpZWxk TmV3IEltYWdl TmV3IFJlbGF0aW9uc2hpcA== - TmV3IENvbW1lbnQ= + TmV3IENvbW1lbnQ= Tm8gUGVybWlzc2lvbnM= UGVybWlzc2lvbnM= TGFiZWxzICYgUGhyYXNlcw== @@ -1380,7 +1381,7 @@ U2l0ZSBEb21haW5z U3BlbGxpbmcgRGljdGlvbmFyeQ== U3RvcCBXb3Jkcw== - U3RydWN0dXJlICYgRGF0YQ== + U3RydWN0dXJlICYgRGF0YQ== U3lzdGVtIFRvb2xz Q2xlYXIgVGVtcGxhdGVzIENhY2hl Q29tbW9ubHkgVXNlZCBLZXlz @@ -1450,7 +1451,7 @@ TmV3IENvbW1lbnQ= TmV3IFNlYXJjaCBGaWVsZA== TmV3IFNpdGUgRG9tYWlu - TmV3IFN0b3AgV29yZA== + TmV3IFN0b3AgV29yZA== TmV3IFRlcm0= TmV3IFRoZW1l TmV3IFVzZXI= Index: install/install_data.sql =================================================================== --- install/install_data.sql (revision 14318) +++ install/install_data.sql (working copy) @@ -103,6 +103,7 @@ INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Min_UserName', '3', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_username', 'text', '', '', 10.03, 0, 0, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Min_Password', '5', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_text_min_password', 'text', '', '', 10.04, 0, 0, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'Users_AllowReset', '180', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_prompt_allow_reset', 'text', NULL, NULL, 10.05, 0, 0, NULL); +INSERT INTO ConfigurationValues VALUES(DEFAULT, 'UserEmailActivationTimeout', '', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_UserEmailActivationTimeout', 'text', NULL, NULL, 10.051, 0, 0, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'User_Password_Auto', '0', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_password_auto', 'checkbox', '', '', 10.06, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'User_MembershipExpirationReminder', '10', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_MembershipExpirationReminder', 'text', NULL, '', 10.07, 0, 1, NULL); INSERT INTO ConfigurationValues VALUES(DEFAULT, 'User_NewGroup', '13', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_users_new_group', 'select', NULL, '0=lu_none||SELECT GroupId as OptionValue, Name as OptionName FROM PortalGroup WHERE Enabled=1 AND Personal=0', 10.08, 0, 1, NULL); Index: install/upgrades.sql =================================================================== --- install/upgrades.sql (revision 14318) +++ install/upgrades.sql (working copy) @@ -2016,4 +2016,7 @@ 'LA_FLD_SELECTORNAME' ); -# ===== v 5.1.2 ===== \ No newline at end of file +# ===== v 5.1.2 ===== + +# ===== v 5.1.3-B1 ===== +INSERT INTO ConfigurationValues VALUES (DEFAULT, 'UserEmailActivationTimeout', '', 'In-Portal:Users', 'in-portal:configure_users', 'la_title_General', 'la_config_UserEmailActivationTimeout', 'text', NULL, NULL, 10.051, 0, 0, NULL); \ No newline at end of file Index: units/users/users_tag_processor.php =================================================================== --- units/users/users_tag_processor.php (revision 14318) +++ units/users/users_tag_processor.php (working copy) @@ -104,7 +104,7 @@ $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'; + $code_type = isset($params['code_type']) ? $params['code_type'] : 'forgot_password'; $error_messages = Array ( 'forgot_password' => Array ( @@ -120,14 +120,21 @@ if ($code_type == 'custom') { // custom error messages are given directly in tag - $error_messages['custom'] = Array ( + $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; } @@ -136,20 +143,27 @@ $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', $error_messages[$code_type]['code_expired']); - return false; - } - } - else { + 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; }