1$(document).ready(function () { 2 3 //Square blue color scheme for iCheck 4 5 $('input[type="checkbox"].square-blue').iCheck({ 6 checkboxClass: 'icheckbox_square-blue' 7 }); 8 9 $("#signup").click(function() { 10 $("#notific").remove(); 11 }); 12 13 $('#login_form').bootstrapValidator({ 14 fields: { 15 username: { 16 validators: { 17 notEmpty: { 18 message: 'Non hai inserito la username' 19 } 20 } 21 }, 22 password: { 23 validators: { 24 notEmpty: { 25 message: 'Non hai inserito la password' 26 } 27 } 28 } 29 30 } 31 }); 32 $("#register_here").bootstrapValidator({ 33 fields: { 34 first_name: { 35 validators: { 36 notEmpty: { 37 message: 'First name is required' 38 } 39 }, 40 required: true, 41 minlength: 3 42 }, 43 last_name: { 44 validators: { 45 notEmpty: { 46 message: 'Last name is required' 47 } 48 }, 49 required: true, 50 minlength: 3 51 }, 52 email: { 53 validators: { 54 notEmpty: { 55 message: 'The email address is required' 56 }, 57 emailAddress: { 58 message: 'The input is not a valid email address' 59 } 60 } 61 }, 62 email_confirm: { 63 validators: { 64 notEmpty: { 65 message: 'The confirm email address is required' 66 }, 67 identical: { 68 field: 'email', 69 message: 'Entered email is not matching with your email' 70 } 71 } 72 }, 73 password: { 74 validators: { 75 notEmpty: { 76 message: 'Password is required' 77 }, 78 different: { 79 field: 'first_name,last_name', 80 message: 'Password should not match first or last name' 81 } 82 } 83 }, 84 password_confirm: { 85 validators: { 86 notEmpty: { 87 message: 'Confirm Password is required' 88 }, 89 identical: { 90 field: 'password' 91 }, 92 different: { 93 field: 'first_name,last_name', 94 message: 'Confirm Password should match with password' 95 } 96 } 97 } 98 } 99 }); 100 $("#reset_pw").bootstrapValidator({ 101 fields: { 102 username: { 103 validators: { 104 notEmpty: { 105 message: 'Inserisci il tuo nome utente' 106 } 107 } 108 } 109 } 110 }); 111 112 // Timer anti-spam per il recupero password (mirroring del timer lato app mobile): 113 // dopo una richiesta il bottone resta disabilitato per N secondi. Lo stato è 114 // persistito in localStorage così sopravvive al reload della pagina. 115 (function forgotPasswordCooldown() { 116 var STORAGE_KEY = 'forgot_password_blocked_until'; 117 var $form = $('#reset_pw'); 118 if (!$form.length) { 119 return; 120 } 121 var $button = $form.find('input[type="submit"]'); 122 var $username = $form.find('input[name="username"]'); 123 var $timer = $('#forgot_timer'); 124 var interval = null; 125 126 function render() { 127 var blockedUntil = parseInt(localStorage.getItem(STORAGE_KEY) || '0', 10); 128 var remaining = Math.ceil((blockedUntil - Date.now()) / 1000); 129 if (remaining > 0) { 130 $button.prop('disabled', true); 131 $username.prop('disabled', true); 132 $timer.text('Riprova tra ' + remaining + ' second' + (remaining === 1 ? 'o' : 'i')).show(); 133 } else { 134 localStorage.removeItem(STORAGE_KEY); 135 $button.prop('disabled', false); 136 $username.prop('disabled', false); 137 $timer.hide(); 138 if (interval) { 139 clearInterval(interval); 140 interval = null; 141 } 142 } 143 } 144 145 function startTicking() { 146 render(); 147 if (!interval) { 148 interval = setInterval(render, 1000); 149 } 150 } 151 152 // Se il server ha appena inviato (o rifiutato per cooldown) una richiesta, 153 // avvia il countdown e riporta l'utente al form di login: così è disincentivato 154 // ad attendere i secondi di blocco per rinviare subito un'altra email. 155 if (window.__forgotCooldown && window.__forgotCooldown > 0) { 156 var blockedUntil = parseInt(localStorage.getItem(STORAGE_KEY) || '0', 10); 157 var serverUntil = Date.now() + window.__forgotCooldown * 1000; 158 // usa la scadenza più lontana tra quella locale e quella indicata dal server 159 localStorage.setItem(STORAGE_KEY, Math.max(blockedUntil, serverUntil).toString()); 160 if (window.location.hash !== '#tologin') { 161 window.location.hash = '#tologin'; 162 } 163 } 164 165 startTicking(); 166 })(); 167});
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.