summaryrefslogtreecommitdiffstats
path: root/hosted
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2012-07-26 17:27:22 +0200
committerTorsten Grote <grote@kolabsys.com>2012-07-26 17:27:22 +0200
commitd72a65514e28d73b13209183567609e2a2e1f564 (patch)
tree398a8c94a4c8c7ccbdd524058edb52ded10aae1e /hosted
parent592454daf41860de5024f249d9453fd8fbf27a2c (diff)
downloadwebadmin-d72a65514e28d73b13209183567609e2a2e1f564.tar.gz
highlight non-matching passwords with javascript
Diffstat (limited to 'hosted')
-rw-r--r--hosted/js/kolab_hosted.js30
1 files changed, 23 insertions, 7 deletions
diff --git a/hosted/js/kolab_hosted.js b/hosted/js/kolab_hosted.js
index daac6f9..8565079 100644
--- a/hosted/js/kolab_hosted.js
+++ b/hosted/js/kolab_hosted.js
@@ -71,22 +71,27 @@ kadm.check_user_availability = function()
kadm.http_post('signup.check_user', {data: data});
} else {
// TODO use translatable string
- kadm.update_user_info('This will not produce a valid email address!');
+ kadm.update_user_info('This will not produce a valid email address!', 'uid');
}
};
-kadm.update_user_info = function(msg)
+kadm.update_user_info = function(msg, part)
{
+ var span_id = 'availability';
+ if(!part.localeCompare('userpassword')) {
+ span_id = 'pass_match';
+ }
+
// display message next to form field
- if($('span[id="availability"]').length) {
+ if($('span[id="'+span_id+'"]').length) {
// update existing span area
- $('span[id="availability"]').html(msg);
+ $('span[id="'+span_id+'"]').html(msg);
}
else {
- // add span area and inform about non-availability
- $('input[name="uid"]').after(' <span id="availability" style="font-weight:bold;margin-left:1em;color:red;">' + msg + '</span>');
+ // add span area and add message
+ $('input[name="'+part+'"]').after(' <span id="'+span_id+'" style="font-weight:bold;margin-left:1em;color:red;">' + msg + '</span>');
}
-
+
// enable/disable button
if(msg == '') {
$('input[type="button"]').removeAttr("disabled");
@@ -96,6 +101,17 @@ kadm.update_user_info = function(msg)
};
+function password_match()
+{
+ if($('input[name="userpassword"]').val().localeCompare($('input[name="userpassword2"]').val())) {
+ // TODO make message translatable
+ kadm.update_user_info("The passwords don't match!", 'userpassword');
+ }
+ else {
+ kadm.update_user_info("", 'userpassword');
+ }
+}
+
// TODO use form.validate api call for that
function isValidEmailAddress(emailAddress) {
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);