lib/client lib/locale public_html/js
Aleksander Machniak
machniak at kolabsys.com
Tue Apr 10 15:55:44 CEST 2012
lib/client/kolab_client_task_user.php | 8 ++++++++
lib/locale/en_US.php | 1 +
public_html/js/kolab_admin.js | 19 +++++++++++++++++++
3 files changed, 28 insertions(+)
New commits:
commit d6853272627f962ffae248dca683b26a84d05aeb
Author: Aleksander Machniak <machniak at kolabsys.com>
Date: Tue Apr 10 15:55:01 2012 +0200
Added 'Generate password' link
diff --git a/lib/client/kolab_client_task_user.php b/lib/client/kolab_client_task_user.php
index e390868..5287006 100644
--- a/lib/client/kolab_client_task_user.php
+++ b/lib/client/kolab_client_task_user.php
@@ -280,6 +280,14 @@ class kolab_client_task_user extends kolab_client_task
// Add password confirmation
if (isset($fields['userpassword'])) {
$fields['userpassword2'] = $fields['userpassword'];
+ // Add 'Generate password' link
+ if (empty($fields['userpassword']['readonly'])) {
+ $fields['userpassword']['suffix'] = kolab_html::a(array(
+ 'content' => $this->translate('password.generate'),
+ 'href' => '#',
+ 'onclick' => "kadm.generate_password('userpassword')",
+ ));
+ }
}
// Hide account type selector if there's only one type
diff --git a/lib/locale/en_US.php b/lib/locale/en_US.php
index 0478581..2e01478 100644
--- a/lib/locale/en_US.php
+++ b/lib/locale/en_US.php
@@ -136,3 +136,4 @@ $LANG['delete.button'] = 'Delete';
$LANG['about.community'] = 'This is the Community Edition of the <b>Kolab Server</b>.';
$LANG['about.warranty'] = 'It comes with absolutely <b>no warranties</b> and is typically run entirely self supported. You can find help & information on the community <a href="http://kolab.org">web site</a> & <a href="http://wiki.kolab.org">wiki</a>.';
$LANG['about.support'] = 'Professional support is available from <a href="http://kolabsys.com">Kolab Systems</a>.';
+$LANG['password.generate'] = 'Generate password';
diff --git a/public_html/js/kolab_admin.js b/public_html/js/kolab_admin.js
index d37c011..36b749f 100644
--- a/public_html/js/kolab_admin.js
+++ b/public_html/js/kolab_admin.js
@@ -1187,6 +1187,25 @@ function kolab_admin()
this.command('group.list', {page: this.env.list_page});
};
+ this.generate_password = function(fieldname)
+ {
+ this.env.password_field = fieldname;
+ this.set_busy(true, 'loading');
+ // we can send only 'attributes' here, because password generation doesn't require object type name/id
+ this.api_post('form_value.generate', {attributes: [fieldname]}, 'generate_password_response');
+ };
+
+ this.generate_password_response = function(response)
+ {
+ if (!this.api_response(response))
+ return;
+
+ var f = this.env.password_field, pass = response.result[f];
+
+ $('input[name="' + f + '"]').val(pass);
+ $('input[name="' + f + '2"]').val(pass);
+ };
+
};
// Add escape() method to RegExp object
More information about the commits
mailing list