Index: branches/5.0.x/core/units/users/users_event_handler.php
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 12117)
+++ branches/5.0.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 12159)
@@ -1,6 +1,6 @@
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: branches/5.0.x/core/kernel/constants.php
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/kernel/constants.php (.../constants.php) (revision 12117)
+++ branches/5.0.x/core/kernel/constants.php (.../constants.php) (revision 12159)
@@ -1,6 +1,6 @@
-
+
+
+
+
+
+
Index: branches/5.0.x/core/units/users/users_item.php
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/units/users/users_item.php (.../users_item.php) (revision 12117)
+++ branches/5.0.x/core/units/users/users_item.php (.../users_item.php) (revision 12159)
@@ -1,6 +1,6 @@
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: branches/5.0.x/core/install/upgrades.sql
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/install/upgrades.sql (.../upgrades.sql) (revision 12117)
+++ branches/5.0.x/core/install/upgrades.sql (.../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: branches/5.0.x/core/units/users/users_tag_processor.php
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 12117)
+++ branches/5.0.x/core/units/users/users_tag_processor.php (.../users_tag_processor.php) (revision 12159)
@@ -1,6 +1,6 @@
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: branches/5.0.x/core/install/english.lang
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/install/english.lang (.../english.lang) (revision 12117)
+++ branches/5.0.x/core/install/english.lang (.../english.lang) (revision 12159)
@@ -893,6 +893,7 @@
VGFi
VGl0bGU=
VXNlcg==
+ RW1haWwgQWN0aXZhdGlvbg==
SW1tZWRpYXRlIA==
VXNlcm5hbWU=
Tm90IEFsbG93ZWQ=
@@ -1659,6 +1660,8 @@
WW91IGhhdmUgYWxyZWFkeSBjb21tZW50ZWQgdGhpcyBpdGVtIQ==
U29ycnksIHRoZSByZXF1ZXN0ZWQgVVJMIHdhcyBub3QgZm91bmQgb24gb3VyIHNlcnZlci4=
RXJyb3IgNDA0IC0gTm90IEZvdW5k
+ QWN0aXZhdGlvbiBjb2RlIGhhcyBleHBpcmVk
+ QWN0aXZhdGlvbiBjb2RlIGlzIG5vdCB2YWxpZA==
Q2F0ZWdvcnkgYWxyZWFkeSBhZGRlZCE=
QWxyZWFkeSBjb21tZW50ZWQ=
Q2F0ZWdvcnkgbGltaXQgcmVhY2hlZCE=
@@ -1913,6 +1916,7 @@
Tm90aGluZyBGb3VuZA==
NDA0LiBQYWdlIG5vdCBmb3VuZCBvbiB0aGUgc2VydmVyLg==
UGxlYXNlIGNvbmZpcm0gdGhhdCB5b3Ugd2FudCB0byByZXNldCB5b3VyIHBhc3N3b3JkLg==
+ VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91IGNhbiBhY3RpdmF0ZSB5b3VyIHJlZ2lzdHJhdGlvbiB1c2luZyBsaW5rIHNlbnQgdG8geW91IGJ5IGVtYWlsLg==
VGhhbmsgeW91IGZvciByZWdpc3RlcmluZyBvbiBvdXIgd2Vic2l0ZS4gWW91ciByZWdpc3RyYXRpb24gaXMgcGVuZGluZyBhZG1pbmlzdHJhdGl2ZSBhcHByb3ZhbC4gWW91IHdpbGwgZ2V0IGEgc2VwYXJhdGUgZW1haWwg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NlciAiPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiIgaGFzIHJlZ2lzdGVyZWQgYW5kIGlzIHBlbmRpbmcgYWRtaW5pc3RyYXRpdmUgYXBwcm92YWwu
WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IFlvdSBoYXZlIGJlZW4gYXBwcm92ZWQKCldlbGNvbWUgdG8gPGlucDI6bV9CYXNlVXJsLz4hDQoNCllvdXIgdXNlciByZWdpc3RyYXRpb24gaGFzIGJlZW4gYXBwcm92ZWQuIFlvdXIgdXNlciBuYW1lIGlzOiAiPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiIu
WC1Qcmlvcml0eTogMQpYLU1TTWFpbC1Qcmlvcml0eTogSGlnaApYLU1haWxlcjogSW4tUG9ydGFsClN1YmplY3Q6IFVzZXIgYXBwcm92ZWQKClVzZXIgIjxpbnAyOnVfRmllbGQgbmFtZT0iTG9naW4iLz4iIGhhcyBiZWVuIGFwcHJvdmVkLg==
Index: branches/5.0.x/themes/default2009/platform/login/activate_confirm.tpl
===================================================================
diff -u
--- branches/5.0.x/themes/default2009/platform/login/activate_confirm.tpl (revision 0)
+++ branches/5.0.x/themes/default2009/platform/login/activate_confirm.tpl (revision 12159)
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
Index: branches/5.0.x/core/install/install_data.sql
===================================================================
diff -u -r12117 -r12159
--- branches/5.0.x/core/install/install_data.sql (.../install_data.sql) (revision 12117)
+++ branches/5.0.x/core/install/install_data.sql (.../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');