1$(document).ready(function($) { 2 $('#register_login').change(checkRegisterLogin); 3 $('#register_password').change(checkRegisterPassword); 4 $('#register_password_confirm').change(checkPasswordConfirm); 5 $('#register_email').change(checkEmail); 6}); 7 8function checkRegisterLogin() { 9 $.ajax('/preuser/check/username/' + $('#register_login').val() , { method: 'get'}) 10 .done(function(data) { 11 if (data === 'OK') 12 $('#register_login').css('background','#cfc'); 13 else 14 $('#register_login').css('background', '#fcc'); 15 }) 16 .fail(function() { 17 $('#register_login').css('background', '#fcc'); 18 }); 19} 20 21function checkRegisterPassword() { 22 if ($('#register_password').val() !== '') { 23 $('#register_password').css('background', '#cfc'); 24 } 25 else { 26 $('#register_password').css('background', '#fcc'); 27 } 28} 29 30function checkPasswordConfirm() { 31 if ($('#register_password').val() === $('#register_password_confirm').val()) { 32 $('#register_password_confirm').css('background', '#cfc'); 33 } 34 else { 35 $('#register_password_confirm').css('background', '#fcc'); 36 } 37} 38 39function checkEmail() { 40 $.ajax('/preuser/check/email/' + $('#register_email').val(), { method: 'get'}) 41 .done(function(data) { 42 if (data === 'OK') 43 $('#register_email').css('background','#cfc'); 44 else 45 $('#register_email').css('background','#fcc'); 46 }) 47 .fail(function() { 48 $('#register_email').css('background','#fcc'); 49 }) 50} 51 52function doRegister() { 53 $('#register_login, #register_password, #register_password_confirm, #register_email, #register_submit').prop('disabled', true); 54 55 var data = { 56 login: $('#register_login').val(), 57 password: $('#register_password').val(), 58 password_confirm: $('#register_password_confirm').val(), 59 email: $('#register_email').val() 60 }; 61 62 $.ajax('/user/do_register', { method: 'post', data: data }) 63 .done(function(data1) { 64 if (data1 === 'OK') { 65 $('#register_content').html('<div class="alert alert-success">Inscription is done, a confirmation email has been sent to you.</div>'); 66 $('#register_error_box').html('') 67 } 68 else { 69 $('#register_error_box').html('<div class="alert alert-danger">'+data1+'</div>'); 70 } 71 }) 72 .fail(function(jqXHR, textStatus, errorThrown) { 73 $('#register_error_box').html('<div class="alert alert-danger">'+errorThrown+'</div>'); 74 }); 75 76 setTimeout(function() { 77 $('#register_login, #register_password, #register_password_confirm, #register_email, #register_submit').prop('disabled', false); 78 }, 1000); 79 80 return false; 81} 82 83function doResetPassword() { 84 $('#register_email, #resetpassword_submit').prop('disabled', true); 85 86 var data = { 87 email: $('#register_email').val() 88 }; 89 90 $.ajax('/user/reset/password', { method: 'post', data: data }) 91 .done(function(data) { 92 if (data == 'OK') { 93 $('#resetpassword_error_box').html('<div class="alert alert-success">If you have an account on this address, you will get an link to reset your password.</div'); 94 } else { 95 $('#resetpassword_error_box').html('<div class="alert alert-success">'+data+'</div>'); 96 } 97 }) 98 .fail(function(data) { 99 $('#resetpassword_error_box').html('<div class="alert alert-danger">Error: '+data+'</div>'); 100 }); 101 102 setTimeout(function() { 103 $('#register_email, #resetpassword_submit').prop('disabled', false); 104 }, 1000); 105 106 return false; 107} 108 109function doRemoveAccount() { 110 var res = confirm("Are you sure you want to remove your account?\nIT CANNOT BE UNDONE."); 111 if (res == false) { 112 return; 113 } 114 115 $.ajax({ 116 type: 'POST', 117 url: '/user/remove_actual', 118 data: { 119 comment: $('#account_remove_comment').val() 120 }, 121 success: function(responseText) { 122 if (responseText == 'OK') { 123 alert("Account removed.\nIt might take few minutes for actual removal of account to be effective on every servers"); 124 window.location.replace("/"); 125 } 126 else { 127 alert(responseText); 128 } 129 }, 130 onFailure: function() { 131 alert("Failed to do request"); 132 } 133 }); 134} 135 136function terms_of_use() { 137 if ($('#checkbox_termssofuse').is(':checked')) { 138 $('#register_submit').show(); 139 } 140 else { 141 $('#register_submit').hide(); 142 } 143}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.