diff options
-rw-r--r-- | settings/js/personal.js | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/settings/js/personal.js b/settings/js/personal.js index d0a471e56b5..9c960a180a1 100644 --- a/settings/js/personal.js +++ b/settings/js/personal.js @@ -4,6 +4,24 @@ * See the COPYING-README file. */ +/** + * Post the email address change to the server. + */ +function changeEmailAddress(){ + emailInfo = $('#lostpassword #email'); + console.log("Timout done."); + if (emailInfo.val() === emailInfo.defaultValue){ + return; + } + //event.preventDefault(); + emailInfo.defaultValue = emailInfo.val(); + OC.msg.startSaving('#lostpassword .msg'); + var post = $( "#lostpassword" ).serialize(); + $.post( 'ajax/lostpassword.php', post, function(data){ + OC.msg.finishedSaving('#lostpassword .msg', data); + }); +} + $(document).ready(function(){ $("#passwordbutton").click( function(){ if ($('#pass1').val() != '' && $('#pass2').val() != '') { @@ -62,18 +80,12 @@ $(document).ready(function(){ }); - $('#lostpassword #email').blur(function(event){ - if ($(this).val() == this.defaultValue){ - return; - } - event.preventDefault(); - this.defaultValue = $(this).val(); - OC.msg.startSaving('#lostpassword .msg'); - var post = $( "#lostpassword" ).serialize(); - $.post( 'ajax/lostpassword.php', post, function(data){ - OC.msg.finishedSaving('#lostpassword .msg', data); - }); - }); + $('#lostpassword #email').keyup(function(){ + if(typeof timeout !== 'undefined'){ + clearTimeout(timeout); + } + timeout = setTimeout('changeEmailAddress()',1000); + }); $("#languageinput").chosen(); |