Index: branches/5.2.x/core/install/install_data.sql =================================================================== diff -u -N -r14606 -r14633 --- branches/5.2.x/core/install/install_data.sql (.../install_data.sql) (revision 14606) +++ branches/5.2.x/core/install/install_data.sql (.../install_data.sql) (revision 14633) @@ -171,6 +171,7 @@ INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER.BOUNCED', NULL, 1, 0, 'Core', 'Form Submission Admin Reply Delivery Failure', 1, 1, 1); INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.NEW.PASSWORD', NULL, 1, 0, 'Core', 'Sends new password to an existing user', 0, 1, 0); INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'USER.ADD.BYADMIN', NULL, 1, 0, 'Core', 'Sends password to a new user', 0, 1, 0); +INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ROOT.RESET.PASSWORD', NULL, 1, 0, 'Core', 'Root Reset Password', 1, 1, 0); INSERT INTO IdGenerator VALUES ('100'); Index: branches/5.2.x/core/units/users/users_event_handler.php =================================================================== diff -u -N -r14630 -r14633 --- branches/5.2.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 14630) +++ branches/5.2.x/core/units/users/users_event_handler.php (.../users_event_handler.php) (revision 14633) @@ -1,6 +1,6 @@ Name == 'OnResetRootPassword' ) { + return defined('DBG_RESET_ROOT') && DBG_RESET_ROOT; + } + if ( !$this->Application->isAdminUser ) { $user_id = $this->Application->RecallVar('user_id'); $items_info = $this->Application->GetVar($event->getPrefixSpecial(true)); @@ -238,8 +242,10 @@ * Checks user data and logs it in if allowed * * @param kEvent $event + * @return void + * @access protected */ - function OnLogin(&$event) + protected function OnLogin(&$event) { $object =& $event->getObject( Array ('form_name' => 'login') ); /* @var $object kDBItem */ @@ -311,7 +317,14 @@ $sync_manager->performAction('LogoutUser'); } - function OnLogout(&$event) + /** + * Performs user logout + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnLogout(&$event) { $user_helper =& $this->Application->recallObject('UserHelper'); /* @var $user_helper UserHelper */ @@ -387,8 +400,10 @@ * Returns subscribed user ID by given e-mail address * * @param string $email + * @return int|bool + * @access protected */ - function getSubscriberByEmail($email) + protected function getSubscriberByEmail($email) { $verify_user =& $this->Application->recallObject('u.verify', null, Array ('skip_autoload' => true)); /* @var $verify_user UsersItem */ @@ -406,6 +421,8 @@ function autoLoginUser(&$event) { $object =& $event->getObject(); + /* @var $object UsersItem */ + $this->Application->SetVar('u.current_id', $object->GetID()); if ( $object->GetDBField('Status') == STATUS_ACTIVE ) { @@ -810,7 +827,13 @@ } } - function OnUpdate(&$event) + /** + * Updates kDBItem + * + * @param kEvent $event + * @access protected + */ + protected function OnUpdate(&$event) { parent::OnUpdate($event); @@ -946,8 +969,8 @@ if ($records) { $conditions = Array(); foreach ($records as $record) { - $email_event_user =& $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRATION.NOTICE', $record['PortalUserId']); - $email_event_admin =& $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRATION.NOTICE'); + $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRATION.NOTICE', $record['PortalUserId']); + $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRATION.NOTICE'); $conditions[] = '(PortalUserId = '.$record['PortalUserId'].' AND GroupId = '.$record['GroupId'].')'; } $sql = 'UPDATE '.TABLE_PREFIX.'UserGroup @@ -964,8 +987,8 @@ $user_ids = $this->Conn->GetCol($sql); if ($user_ids) { foreach ($user_ids as $id) { - $email_event_user =& $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRED', $id); - $email_event_admin =& $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRED'); + $this->Application->EmailEventUser('USER.MEMBERSHIP.EXPIRED', $id); + $this->Application->EmailEventAdmin('USER.MEMBERSHIP.EXPIRED'); } } $sql = 'DELETE FROM '.TABLE_PREFIX.'UserGroup @@ -1013,9 +1036,10 @@ } /** - * Overwritten to return user from order by special .ord + * Return user from order by special .ord * * @param kEvent $event + * @return int */ function getPassedID(&$event) { @@ -1148,28 +1172,37 @@ $event->SetRedirectParam('opener', 'u'); } - function OnMassResetSettings(&$event) + /** + * Resets grid settings, remembered in each user record + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnMassResetSettings(&$event) { - if ($this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1)) { + if ( $this->Application->CheckPermission('SYSTEM_ACCESS.READONLY', 1) ) { $event->status = kEvent::erFAIL; return; } $ids = $this->StoreSelectedIDs($event); $default_user_id = $this->Application->ConfigValue('DefaultSettingsUserId'); - if (in_array($default_user_id, $ids)) { + if ( in_array($default_user_id, $ids) ) { array_splice($ids, array_search($default_user_id, $ids), 1); } - if ($ids) { - $q = 'DELETE FROM '.TABLE_PREFIX.'PersistantSessionData WHERE PortalUserId IN ('.join(',', $ids).') AND + + if ( $ids ) { + $q = 'DELETE FROM ' . TABLE_PREFIX . 'PersistantSessionData WHERE PortalUserId IN (' . join(',', $ids) . ') AND (VariableName LIKE "%_columns_%" OR VariableName LIKE "%_filter%" OR VariableName LIKE "%_PerPage%")'; $this->Conn->Query($q); } + $this->clearSelectedIDs($event); } @@ -1706,4 +1739,26 @@ } } } + + /** + * Generates new Root password and email it + * + * @param kEvent $event + * @return void + * @access protected + */ + protected function OnResetRootPassword(&$event) + { + $password_formatter =& $this->Application->recallObject('kPasswordFormatter'); + /* @var $password_formatter kPasswordFormatter */ + + $new_root_password = kUtil::generatePassword(); + $new_root_password_encrypted = $password_formatter->EncryptPassword($new_root_password, 'b38'); + + $this->Application->SetConfigValue('RootPass', $new_root_password_encrypted); + $this->Application->EmailEventAdmin('ROOT.RESET.PASSWORD', null, Array ('password' => $new_root_password)); + + $event->SetRedirectParam('reset', 1); + $event->SetRedirectParam('pass', 'm'); + } } Index: branches/5.2.x/tools/debug_sample.php =================================================================== diff -u -N -r14244 -r14633 --- branches/5.2.x/tools/debug_sample.php (.../debug_sample.php) (revision 14244) +++ branches/5.2.x/tools/debug_sample.php (.../debug_sample.php) (revision 14633) @@ -1,6 +1,6 @@ " class="kx-login-button roundbutton"> + + + + + +
+ +
+

401 Authentication Required

Index: branches/5.2.x/core/install/upgrades.sql =================================================================== diff -u -N -r14630 -r14633 --- branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14630) +++ branches/5.2.x/core/install/upgrades.sql (.../upgrades.sql) (revision 14633) @@ -2136,4 +2136,5 @@ CHANGE ip IPAddress VARCHAR(15) NOT NULL, ADD IPRestrictions TEXT NULL; -ALTER TABLE PortalGroup ADD IPRestrictions TEXT NULL; \ No newline at end of file +ALTER TABLE PortalGroup ADD IPRestrictions TEXT NULL; +INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'ROOT.RESET.PASSWORD', NULL, 1, 0, 'Core', 'Root Reset Password', 1, 1, 0); \ No newline at end of file Index: branches/5.2.x/core/install/english.lang =================================================================== diff -u -N -r14630 -r14633 --- branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14630) +++ branches/5.2.x/core/install/english.lang (.../english.lang) (revision 14633) @@ -1506,6 +1506,8 @@ QXV0by1EZXRlY3Q= Q29va2llcw== UXVlcnkgU3RyaW5nIChTSUQp + UmVzZXQgInJvb3QiIHBhc3N3b3Jk + WW91ciAicm9vdCIgcGFzc3dvcmQgaGFzIGJlZW4gcmVzZXQuIFBsZWFzZSByZW1vdmUgREJHX1JFU0VUX1JPT1QgY29uc3RhbnQgYW5kIGNoZWNrIHlvdXIgZS1tYWlsIGFkZHJ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