summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2013-09-24 13:06:54 (GMT)
committerAleksander Machniak <alec@alec.pl>2013-09-24 13:06:54 (GMT)
commit85ff5b5a89483c0988d128291c6da717a1d91ca0 (patch)
treed195429a121e487bda9abae56b93e248785285ac
parentf3a19e4fb68f13980edd21a7c4588b4906ff058e (diff)
downloadkolab-wap-85ff5b5a89483c0988d128291c6da717a1d91ca0.tar.gz
Prevent from submitting signup form while other requests didn't finish,
e.g. while checking for user existance (Bug #2061)
-rw-r--r--public_html/js/kolab_hosted.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/public_html/js/kolab_hosted.js b/public_html/js/kolab_hosted.js
index c410b01..31e1cdc 100644
--- a/public_html/js/kolab_hosted.js
+++ b/public_html/js/kolab_hosted.js
@@ -24,22 +24,25 @@
// overwrite user_save() function
kadm.user_save = function(reload, section)
{
- var data = kadm.serialize_form('#'+this.env.form_id);
+ if (this.busy)
+ return;
+
+ var data = this.serialize_form('#'+this.env.form_id);
- if (!kadm.check_required_fields(data)) {
- kadm.display_message('form.required.empty', 'error');
+ if (!this.check_required_fields(data)) {
+ this.display_message('form.required.empty', 'error');
return;
}
// check password
if (data.userpassword != data.userpassword2) {
- kadm.display_message('user.password.mismatch', 'error');
- kadm.form_value_error('userpassword2');
+ this.display_message('user.password.mismatch', 'error');
+ this.form_value_error('userpassword2');
return;
}
delete data['userpassword2'];
- kadm.http_post('signup.add_user', {data: data});
+ this.http_post('signup.add_user', {data: data});
};
kadm.reload_captcha = function()
@@ -49,7 +52,7 @@ kadm.reload_captcha = function()
kadm.change_user_type = function()
{
- var data = kadm.serialize_form('#'+this.env.form_id);
+ var data = this.serialize_form('#'+this.env.form_id);
this.set_busy(true, 'loading');
kadm.http_post('signup.default', {data: data});
@@ -58,7 +61,7 @@ kadm.change_user_type = function()
kadm.check_user_availability = function()
{
// get form data and build new email address
- var data = kadm.serialize_form('#signup-form');
+ var data = this.serialize_form('#signup-form');
var mail = data.uid + '@' + data.domain;
if(data.uid) {
@@ -67,9 +70,10 @@ kadm.check_user_availability = function()
$('input[name="mail"]').val(mail);
// check if user with that email address already exists
- kadm.http_post('signup.check_user', {data: data});
+ this.set_busy(true, 'loading');
+ this.http_post('signup.check_user', {data: data});
} else {
- kadm.update_user_info('signup.wronguid', 'uid');
+ this.update_user_info('signup.wronguid', 'uid');
}
}
};
@@ -82,7 +86,7 @@ kadm.update_user_info = function(msg, part)
}
if (msg) {
- msg = kadm.t(msg);
+ msg = this.t(msg);
}
// display message next to form field