summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2012-04-10 13:55:01 (GMT)
committerAleksander Machniak <machniak@kolabsys.com>2012-04-10 13:55:01 (GMT)
commitd6853272627f962ffae248dca683b26a84d05aeb (patch)
tree746bab3adf63cd1da9f7b120971b09d09b256e07
parent15c708059b62c9888a3942d129957251e76dc0ea (diff)
downloadkolab-wap-d6853272627f962ffae248dca683b26a84d05aeb.tar.gz
Added 'Generate password' link
-rw-r--r--lib/client/kolab_client_task_user.php8
-rw-r--r--lib/locale/en_US.php1
-rw-r--r--public_html/js/kolab_admin.js19
3 files changed, 28 insertions, 0 deletions
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