Index: admin_templates/incs/form_blocks.tpl
===================================================================
--- admin_templates/incs/form_blocks.tpl (revision 14446)
+++ admin_templates/incs/form_blocks.tpl (working copy)
@@ -638,7 +638,6 @@
<inp2:m_RenderElement design="form_row" pass_params="1">
<td class="control-cell">
<input type="hidden" id="<inp2:{$prefix}_InputName field='$field'/>" name="<inp2:{$prefix}_InputName field='$field'/>" value="<inp2:{$prefix}_Field field='$field' db='db'/>">
- <!--<input tabindex="<inp2:m_get param='tab_index'/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field='$field'/>" name="_cb_<inp2:{$prefix}_InputName field='$field'/>" <inp2:{$prefix}_Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name='field_class'/>" onclick="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field='$field'/>'));" onchange="<inp2:m_param name='onchange'/>">-->
<input tabindex="<inp2:m_get param='tab_index'/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field='$field'/>" name="_cb_<inp2:{$prefix}_InputName field='$field'/>" <inp2:{$prefix}_Field field="$field" checked="checked" db="db"/> class="<inp2:m_param name='field_class'/>" onchange="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field='$field'/>'));<inp2:m_param name='onchange'/>" onclick="<inp2:m_param name='onclick'/>">
</td>
</inp2:m_RenderElement>
Index: admin_templates/users/admins_edit.tpl
===================================================================
--- admin_templates/users/admins_edit.tpl (revision 14446)
+++ admin_templates/users/admins_edit.tpl (working copy)
@@ -59,6 +59,7 @@
<inp2:u_SaveWarning name="grid_save_warning"/>
<inp2:u_ErrorWarning name="form_error_warning"/>
+<inp2:m_include template="users/user_blocks"/>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="u" field="UserType"/>
<inp2:m_RenderElement name="inp_edit_hidden" prefix="u" field="PrimaryGroupId"/>
@@ -67,8 +68,8 @@
<table class="edit-form">
<inp2:m_RenderElement name="inp_id_label" prefix="u" field="PortalUserId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Login" title="la_fld_Username"/>
- <inp2:m_RenderElement name="inp_edit_password" prefix="u" field="Password" title="la_fld_Password"/>
- <inp2:m_RenderElement name="inp_edit_password" prefix="u" field="VerifyPassword" title="la_fld_VerifyPassword"/>
+ <inp2:m_RenderElement name="password_fields" />
+
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="FirstName" title="la_fld_FirstName"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="LastName" title="la_fld_LastName"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Email" title="la_fld_Email"/>
@@ -76,4 +77,12 @@
</table>
</div>
+<script type="text/javascript">
+ $(document).ready(
+ function() {
+ <inp2:m_RenderElement name="password_fields_js" />
+ }
+ );
+</script>
+
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: admin_templates/users/user_blocks.tpl
===================================================================
--- admin_templates/users/user_blocks.tpl (revision 0)
+++ admin_templates/users/user_blocks.tpl (revision 0)
@@ -0,0 +1,70 @@
+<inp2:m_DefineElement name="password_fields">
+ <inp2:m_RenderElement design="form_row" prefix="u" field="Password" title="la_fld_Password">
+ <td class="control-cell">
+ <input type="password" name="<inp2:{$prefix}_InputName field='$field'/>" id="<inp2:{$prefix}_InputName field='$field'/>" value="<inp2:{$prefix}_Field name='{$field}_plain'/>" tabindex="<inp2:m_get param='tab_index'/>"/>
+ <input type="button" class="button" id="generate_password" value="<inp2:m_Phrase name='la_btn_Generate' no_editing='1'/>"/>
+
+ <script type="text/javascript">
+ $(document).ready(
+ function() {
+ <inp2:m_ifnot check="{$prefix}_Field" name="{$field}_plain">
+ $('#' + jq('<inp2:{$prefix}_InputName field="$field"/>')).val('');
+ </inp2:m_ifnot>
+ }
+ );
+ </script>
+ </td>
+ </inp2:m_RenderElement>
+
+ <inp2:m_RenderElement design="form_row" prefix="u" field="VerifyPassword" title="la_fld_VerifyPassword">
+ <td class="control-cell">
+ <input type="password" name="<inp2:{$prefix}_InputName field='$field'/>" id="<inp2:{$prefix}_InputName field='$field'/>" value="<inp2:{$prefix}_Field name='{$field}_plain'/>" tabindex="<inp2:m_get param='tab_index'/>"/>
+
+ <span<inp2:m_ifnot check="{$prefix}_Field" name="Password_plain"> style="display: none"</inp2:m_ifnot> id="email_password">
+ <input type="hidden" id="<inp2:{$prefix}_InputName field='EmailPassword'/>" name="<inp2:{$prefix}_InputName field='EmailPassword'/>" value="<inp2:{$prefix}_Field field='EmailPassword' db='db'/>">
+ <input tabindex="<inp2:m_get param='tab_index'/>" type="checkbox" id="_cb_<inp2:{$prefix}_InputName field='EmailPassword'/>" name="_cb_<inp2:{$prefix}_InputName field='EmailPassword'/>" <inp2:{$prefix}_Field field="EmailPassword" checked="checked" db="db"/> onchange="update_checkbox(this, document.getElementById('<inp2:{$prefix}_InputName field='EmailPassword'/>'));"/>
+ <label for="_cb_<inp2:{$prefix}_InputName field='EmailPassword'/>"><inp2:m_Phrase name="la_fld_EmailPassword"/></label>
+ </span>
+
+ <script type="text/javascript">
+ $(document).ready(
+ function() {
+ <inp2:m_ifnot check="{$prefix}_Field" name="{$field}_plain">
+ $('#' + jq('<inp2:{$prefix}_InputName field="$field"/>')).val('');
+ </inp2:m_ifnot>
+ }
+ );
+ </script>
+ </td>
+ </inp2:m_RenderElement>
+</inp2:m_DefineElement>
+
+<inp2:m_DefineElement name="password_fields_js">
+ var $field_mask = '<inp2:u_InputName name="#FIELD_NAME#" js_escape="1"/>';
+ var $email_phrase = '<inp2:m_Phrase name="la_fld_EmailPassword" js_escape="1"/>';
+
+ $( get_control($field_mask, 'Password') ).change(
+ function ($e) {
+ var $password = $(this).val();
+
+ if ($password) {
+ $('label', '#email_password').html( $email_phrase.replace('{password}', $password) );
+ $('#email_password').show();
+ }
+ }
+ );
+
+ $('#generate_password').click(
+ function ($e) {
+ $.get(
+ '<inp2:m_Link template="dummy" events[u]="OnGeneratePassword" no_amp="1" js_escape="1"/>',
+ function ($password) {
+ $( get_control($field_mask, 'Password') ).val($password).change();
+ $( get_control($field_mask, 'VerifyPassword') ).val($password);
+ }
+ )
+ }
+ );
+
+ $('label', '#email_password').html( $email_phrase.replace('{password}', '<inp2:u_Field name="Password_plain"/>') );
+</inp2:m_DefineElement>
\ No newline at end of file
Index: admin_templates/users/users_edit.tpl
===================================================================
--- admin_templates/users/users_edit.tpl (revision 14446)
+++ admin_templates/users/users_edit.tpl (working copy)
@@ -58,14 +58,14 @@
<inp2:u_SaveWarning name="grid_save_warning"/>
<inp2:u_ErrorWarning name="form_error_warning"/>
+<inp2:m_include template="users/user_blocks"/>
<div id="scroll_container">
<table class="edit-form">
<inp2:m_RenderElement name="subsection" prefix="u" fields="PortalUserId,Login,Password" title="la_section_General"/>
<inp2:m_RenderElement name="inp_id_label" prefix="u" field="PortalUserId" title="la_fld_Id"/>
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="Login" title="la_fld_Username"/>
- <inp2:m_RenderElement name="inp_edit_password" prefix="u" field="Password" title="la_fld_Password"/>
- <inp2:m_RenderElement name="inp_edit_password" prefix="u" field="VerifyPassword" title="la_fld_VerifyPassword"/>
+ <inp2:m_RenderElement name="password_fields" />
<inp2:m_RenderElement name="subsection" prefix="u" fields="FirstName,LastName,Company,Email,dob,Phone,Fax,Street,Street2,City,State,Zip,Country" title="la_prompt_PersonalInfo"/> <!-- OLD PHRASE, la_section_PersonalInformation -->
<inp2:m_RenderElement name="inp_edit_box" prefix="u" field="FirstName" title="la_fld_FirstName"/>
@@ -98,4 +98,12 @@
</table>
</div>
+<script type="text/javascript">
+ $(document).ready(
+ function() {
+ <inp2:m_RenderElement name="password_fields_js" />
+ }
+ );
+</script>
+
<inp2:m_include t="incs/footer"/>
\ No newline at end of file
Index: install/english.lang
===================================================================
--- install/english.lang (revision 14446)
+++ install/english.lang (working copy)
@@ -30,6 +30,7 @@
<PHRASE Label="la_btn_EditBlock" Module="Core" Type="1">RWRpdCBCbG9jaw==</PHRASE>
<PHRASE Label="la_btn_EditContent" Module="Core" Type="1">RWRpdCBDb250ZW50</PHRASE>
<PHRASE Label="la_btn_EditDesign" Module="Core" Type="1">RWRpdCBEZXNpZ24=</PHRASE>
+ <PHRASE Label="la_btn_Generate" Module="Core" Type="1">R2VuZXJhdGU=</PHRASE>
<PHRASE Label="la_btn_GetValue" Module="Core" Type="1">R2V0IFZhbHVl</PHRASE>
<PHRASE Label="la_btn_Locate" Module="Core" Type="1">TG9jYXRl</PHRASE>
<PHRASE Label="la_btn_MoveDown" Module="Core" Type="1">TW92ZSBEb3du</PHRASE>
@@ -428,6 +429,7 @@
<PHRASE Label="la_fld_ElapsedTime" Module="Core" Type="1">RWxhcHNlZCBUaW1l</PHRASE>
<PHRASE Label="la_fld_Email" Module="Core" Type="1">RS1tYWls</PHRASE>
<PHRASE Label="la_fld_EmailCommunicationRole" Module="Core" Type="1">RS1tYWlsIENvbW11bmljYXRpb24gUm9sZQ==</PHRASE>
+ <PHRASE Label="la_fld_EmailPassword" Module="Core" Type="1">RS1tYWlsICI8c3Ryb25nPntwYXNzd29yZH08L3N0cm9uZz4iIHBhc3N3b3JkIHRvIHVzZXI=</PHRASE>
<PHRASE Label="la_fld_EmailsQueued" Module="Core" Type="1">RW1haWxzIGluIFF1ZXVl</PHRASE>
<PHRASE Label="la_fld_EmailsSent" Module="Core" Type="1">RW1haWxzIFNlbnQ=</PHRASE>
<PHRASE Label="la_fld_EmailsTotal" Module="Core" Type="1">RW1haWxzIFRvdGFs</PHRASE>
@@ -1575,6 +1577,7 @@
<EVENT MessageType="html" Event="FORM.SUBMITTED" Type="1">U3ViamVjdDogTmV3IGZvcm0gc3VibWlzc2lvbgoKPHA+Rm9ybSBoYXMgYmVlbiBzdWJtaXR0ZWQuIFBsZWFzZSBwcm9jZWVkIHRvIHRoZSBBZG1pbiBDb25zb2xlIHRvIHJldmlldyB0aGUgc3VibWlzc2lvbiE8L3A+</EVENT>
<EVENT MessageType="html" Event="USER.ADD" Type="0">U3ViamVjdDogSW4tcG9ydGFsIHJlZ2lzdHJhdGlvbgoKRGVhciA8aW5wMjp1X0ZpZWxkIG5hbWU9IkZpcnN0TmFtZSIgLz4gPGlucDI6dV9GaWVsZCBuYW1lPSJMYXN0TmFtZSIgLz4sDQoNClRoYW5rIHlvdSBmb3IgcmVnaXN0ZXJpbmcgb24gPGlucDI6bV9CYXNlVXJsLz4uIFlvdXIgcmVnaXN0cmF0aW9uIGlzIG5vdyBhY3RpdmUu</EVENT>
<EVENT MessageType="html" Event="USER.ADD" Type="1">U3ViamVjdDogTmV3IFVzZXIgUmVnaXN0cmF0aW9uICg8aW5wMjp1X0ZpZWxkIG5hbWU9IkxvZ2luIi8+KQoKQSBuZXcgdXNlciAiPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiIgaGFzIGJlZW4gYWRkZWQu</EVENT>
+ <EVENT MessageType="text" Event="USER.ADD.BYADMIN" Type="0">U3ViamVjdDogTmV3IHVzZXIgaGFzIGJlZW4gY3JlYXRlZAoKRGVhciA8aW5wMjp1X0ZpZWxkIG5hbWU9IkZpcnN0TmFtZSIvPiwNCg0KQSBuZXcgdXNlciBoYXMgYmVlbiBjcmVhdGVkIGFuZCBhc3NpZ25lZCB0byB5b3UNCg0KTm93IHlvdSBjYW4gbG9naW4gdXNpbmcgdGhlIGZvbGxvd2luZyBjcmVkZW50aWFsczoNCg0KPGlucDI6bV9pZiBjaGVjaz0idV9GaWVsZCIgbmFtZT0iTG9naW4iPlVzZXJuYW1lOiA8aW5wMjp1X0ZpZWxkIG5hbWU9IkxvZ2luIi8+PGlucDI6bV9lbHNlLz5FLW1haWw6IDxpbnAyOnVfRmllbGQgbmFtZT0iRW1haWwiLz48L2lucDI6bV9pZj4gDQpQYXNzd29yZDogPGlucDI6dV9GaWVsZCBuYW1lPSJQYXNzd29yZF9wbGFpbiIvPiANCg==</EVENT>
<EVENT MessageType="html" Event="USER.ADD.PENDING" Type="0">U3ViamVjdDogTmV3IFVzZXIgUmVnaXN0cmF0aW9uICg8aW5wMjptX2lmIGNoZWNrPSJtX0dldENv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V2VsY29tZSB0byA8aW5wMjptX0Jhc2VVcmwvPiENCg0KWW91ciB1c2VyIHJlZ2lzdHJhdGlvbiBoYXMgYmVlbiBhcHByb3ZlZC4gWW91ciB1c2VyIG5hbWUgaXM6ICI8aW5wMjp1X0ZpZWxkIG5hbWU9IkxvZ2luIi8+Ii4=</EVENT>
@@ -1585,6 +1588,7 @@
<EVENT MessageType="html" Event="USER.MEMBERSHIP.EXPIRATION.NOTICE" Type="1">U3ViamVjdDogTWVtYmVyc2hpcCBFeHBpcmF0aW9uIE5vdGljZSBmb3IgIjxpbnAyOnVfRmllbGQgbmFtZT0iTG9naW4iLz4iIFNlbnQKClVzZXIgPGlucDI6dV9GaWVsZCBuYW1lPSJMb2dpbiIvPiBtZW1iZXJzaGlwIHdpbGwgZXhwaXJlIHNvb24u</EVENT>
<EVENT MessageType="html" Event="USER.MEMBERSHIP.EXPIRED" Type="0">U3ViamVjdDogWW91ciBNZW1iZXJzaGlwIEV4cGlyZWQKCllvdXIgbWVtYmVyc2hpcCBvbiA8aW5wMjptX0Jhc2VVcmwvPiB3ZWJzaXRlIGhhcyBleHBpcmVkLg==</EVENT>
<EVENT MessageType="html" Event="USER.MEMBERSHIP.EXPIRED" Type="1">U3ViamVjdDogVXNlcidzIE1lbWJlcnNoaXAgRXhwaXJlZCAgKCA8aW5wMjp1X0ZpZWxkIG5hbWU9IkxvZ2luIi8+KQoKVXNlcidzICg8aW5wMjp1X0ZpZWxkIG5hbWU9IkxvZ2luIi8+KSBtZW1iZXJzaGlwIG9uIDxpbnAyOm1fQmFzZVVybC8+IHdlYnNpdGUgaGFzIGV4cGlyZWQu</EVENT>
+ <EVENT MessageType="text" Event="USER.NEW.PASSWORD" Type="0">U3ViamVjdDogTmV3IHBhc3N3b3JkIGdlbmVyYXRlZAoKRGVhciA8aW5wMjp1X0ZpZWxkIG5hbWU9IkZpcnN0TmFtZSIvPiwNCg0KQSBuZXcgcGFzc3dvcmQgaGFzIGJlZW4gZ2VuZXJhdGV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IgSW4tcG9ydGFsIGFjY291bnQuIElmIHlvdSB3b3VsZCBsaWtlIHRvIHByb2NlZWQgYW5kIGNoYW5nZSB0aGUgcGFzc3dvcmQsIHBsZWFzZSBjbGljayBvbiB0aGUgbGluayBiZWxvdzo8YnIvPjxici8+DQoNCjxhIGhyZWY9IjxpbnAyOnVfQ29uZmlybVBhc3N3b3JkTGluayBub19hbXA9IjEiLz4iPjxpbnAyOnVfQ29uZmlybVBhc3N3b3JkTGluayBub19hbXA9IjEiLz48L2E+PGJyLz48YnIvPg0KDQpZb3Ugd2lsbCByZWNlaXZlIGEgc2Vjb25kIGVtYWlsIHdpdGggeW91ciBuZXcgcGFzc3dvcmQgc2hvcnRseS48YnIvPjxici8+DQoNCklmIHlvdSBiZWxpZXZlIHlvdSBoYXZlIHJlY2VpdmVkIHRoaXMgZW1haWwgaW4gZXJyb3IsIHBsZWFzZSBpZ25vcmUgdGhpcyBlbWFpbC4gWW91ciBwYXNzd29yZCB3aWxsIG5vdCBiZSBjaGFuZ2VkIHVubGVzcyB5b3UgaGF2ZSBjbGlja2VkIG9uIHRoZSBhYm92ZSBsaW5rLg0K</EVENT>
Index: install/install_data.sql
===================================================================
--- install/install_data.sql (revision 14446)
+++ install/install_data.sql (working copy)
@@ -167,6 +167,8 @@
INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.TO.USER', NULL, 1, 0, 'Core', 'Admin Reply to User Form Submission', 1, 1, 1);
INSERT INTO Events (EventId, Event, ReplacementTags, Enabled, FrontEndOnly, Module, Description, Type, AllowChangingSender, AllowChangingRecipient) VALUES(DEFAULT, 'FORM.SUBMISSION.REPLY.FROM.USER', NULL, 1, 0, 'Core', 'User Replied to It\'s Form Submission', 1, 1, 1);
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 IdGenerator VALUES ('100');
Index: units/users/users_config.php
===================================================================
--- units/users/users_config.php (revision 14447)
+++ units/users/users_config.php (working copy)
@@ -424,7 +424,7 @@
'SubscribeEmail' => Array('type'=>'string','default'=>''),
'PrimaryGroup' => Array('type' => 'string', 'default' => ''),
'RootPassword' => Array('type' => 'string', 'formatter' => 'kPasswordFormatter', 'encryption_method' => 'md5', 'verify_field' => 'VerifyRootPassword', 'skip_empty' => 1, 'default' => md5('') ),
-
+ 'EmailPassword' => Array ('type' => 'string', 'default' => ''),
'FullName' => Array ('type' => 'string', 'default' => ''),
),
Index: units/users/users_event_handler.php
===================================================================
--- units/users/users_event_handler.php (revision 14447)
+++ units/users/users_event_handler.php (working copy)
@@ -29,6 +29,7 @@
'OnUpdateRootPassword' => Array('self' => true),
'OnUpdatePassword' => Array('self' => true),
'OnSaveSelected' => Array ('self' => 'view'),
+ 'OnGeneratePassword' => Array ('self' => 'view'),
// front
'OnRefreshForm' => Array('self' => true),
@@ -297,7 +298,7 @@
*/
function OnAfterItemCreate(&$event)
{
- $this->saveUserImages($event);
+ $this->afterItemChanged($event);
$object =& $event->getObject();
/* @var $object kDBItem */
@@ -1285,7 +1286,7 @@
*/
function OnAfterItemUpdate(&$event)
{
- $this->saveUserImages($event);
+ $this->afterItemChanged($event);
$object =& $event->getObject();
/* @var $object UsersItem */
@@ -1298,6 +1299,27 @@
}
/**
+ * Occurs, after item is changed
+ *
+ * @param kEvent $event
+ */
+ function afterItemChanged(&$event)
+ {
+ $this->saveUserImages($event);
+
+ $object =& $event->getObject();
+ /* @var $object kDBItem */
+
+ if ( $object->GetDBField('EmailPassword') && $object->GetDBField('Password_plain') ) {
+ $email_passwords = $this->Application->RecallVar('email_passwords');
+ $email_passwords = $email_passwords ? unserialize($email_passwords) : Array ();
+
+ $email_passwords[ $object->GetID() ] = $object->GetDBField('Password_plain');
+ $this->Application->StoreVar('email_passwords', serialize($email_passwords));
+ }
+ }
+
+ /**
* Stores user's original Status before overwriting with data from temp table
*
* @param kEvent $event
@@ -1324,15 +1346,34 @@
function OnAfterCopyToLive(&$event)
{
$temp_id = $event->getEventParam('temp_id');
- if ($temp_id == 0) {
- // this is new user create, don't send email events
- return ;
+ $email_passwords = $this->Application->RecallVar('email_passwords');
+
+ if ( $email_passwords ) {
+ $email_passwords = unserialize($email_passwords);
+
+ if ( isset($email_passwords[$temp_id]) ) {
+ $object =& $event->getObject();
+ /* @var $object kDBItem */
+
+ $object->SwitchToLive();
+ $object->Load( $event->getEventParam('id') );
+ $object->SetField('Password', $email_passwords[$temp_id]);
+ $object->SetField('VerifyPassword', $email_passwords[$temp_id]);
+
+ $this->Application->EmailEventUser($temp_id > 0 ? 'USER.NEW.PASSWORD': 'USER.ADD.BYADMIN', $object->GetID());
+
+ unset($email_passwords[$temp_id]);
+ $this->Application->StoreVar('email_passwords', serialize($email_passwords));
+ }
}
- $new_status = $this->getUserStatus($temp_id);
- $user_status = $this->Application->GetVar('user_status');
+ if ( $temp_id > 0 ) {
+ // only send status change e-mail on user update
+ $new_status = $this->getUserStatus($temp_id);
+ $user_status = $this->Application->GetVar('user_status');
- $this->sendStatusChangeEvent($temp_id, $user_status[$temp_id], $new_status);
+ $this->sendStatusChangeEvent($temp_id, $user_status[$temp_id], $new_status);
+ }
}
/**
@@ -1601,22 +1642,28 @@
{
parent::OnPreCreate($event);
- if ($event->status == kEvent::erSUCCESS) {
- $user_type = $this->Application->GetVar('user_type');
+ if ($event->status != kEvent::erSUCCESS) {
+ return ;
+ }
- if ($user_type) {
- $object =& $event->getObject();
- /* @var $object kDBItem */
+ $object =& $event->getObject();
+ /* @var $object kDBItem */
- $object->SetDBField('UserType', $user_type);
+ $user_type = $this->Application->GetVar('user_type');
- if ( $user_type == UserType::ADMIN ) {
- $object->SetDBField('PrimaryGroupId', $this->Application->ConfigValue('User_AdminGroup'));
- }
+ if ($user_type) {
+ $object->SetDBField('UserType', $user_type);
+
+ if ( $user_type == UserType::ADMIN ) {
+ $object->SetDBField('PrimaryGroupId', $this->Application->ConfigValue('User_AdminGroup'));
}
+ }
- $this->_makePasswordRequired($event);
+ if ( $this->Application->ConfigValue('User_Password_Auto') ) {
+ $object->SetDBField('EmailPassword', 1);
}
+
+ $this->_makePasswordRequired($event);
}
/**
@@ -1670,4 +1717,18 @@
parent::LoadItem($event);
}
+
+ /**
+ * Generates password
+ *
+ * @param kEvent $event
+ */
+ function OnGeneratePassword(&$event)
+ {
+ $event->status = kEvent::erSTOP;
+
+ if ( $this->Application->isAdminUser ) {
+ echo kUtil::generatePassword();
+ }
+ }
}