scratch – Diff between revs 91 and 94

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 91 Rev 94
Line 158... Line 158...
158 excludePixelRatio: true 158 excludePixelRatio: true
159 }).get((result, components) => { 159 }).get((result, components) => {
160 // Set the nick as a cookie. 160 // Set the nick as a cookie.
161 const fingerprint = result; 161 const fingerprint = result;
162 var nick = Cookies.get('nick'); 162 var nick = Cookies.get('nick');
163 if(!nick || nick.length !== 32) { 163 if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick)) {
164 Cookies.set('nick', result, { path: '' }); 164 Cookies.set('nick', result, { path: '' });
165 nick = result; 165 nick = result;
166 } 166 }
167 else 167 else
168 result = nick; 168 result = nick;
Line 276... Line 276...
276 }); 276 });
Line 277... Line 277...
277 277
278 // When the button is clicked, navigate to the fingerprint. 278 // When the button is clicked, navigate to the fingerprint.
279 $('#go').click(() => { 279 $('#go').click(() => {
280 nick = $('#nick').val(); 280 nick = $('#nick').val();
281 if(!nick || nick.length != 32) 281 if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick))
282 return; 282 return;
283 Cookies.set('nick', nick, { path: '' }); 283 Cookies.set('nick', nick, { path: '' });
Line 284... Line 284...
284 result = nick; 284 result = nick;
Line 310... Line 310...
310 // When the form is submitted, naigate to the fingerprint. 310 // When the form is submitted, naigate to the fingerprint.
311 $('#nick-form').submit((e) => { 311 $('#nick-form').submit((e) => {
312 e.preventDefault(); 312 e.preventDefault();
Line 313... Line 313...
313 313
314 nick = $('#nick').val(); 314 nick = $('#nick').val();
315 if(!nick || nick.length != 32) 315 if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick))
316 return; 316 return;
317 Cookies.set('nick', nick, { path: '' }); 317 Cookies.set('nick', nick, { path: '' });
Line 318... Line 318...
318 result = nick; 318 result = nick;
Line 342... Line 342...
342 }); 342 });
Line 343... Line 343...
343 343
344 // While the nick is changing, navigate to the changed fingerprint. 344 // While the nick is changing, navigate to the changed fingerprint.
345 $("#nick").on('input', () => { 345 $("#nick").on('input', () => {
346 nick = $('#nick').val(); 346 nick = $('#nick').val();
347 if(!nick || nick.length != 32) 347 if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick))
348 return; 348 return;
349 Cookies.set('nick', nick, { path: '' }); 349 Cookies.set('nick', nick, { path: '' });
Line 350... Line 350...
350 result = nick; 350 result = nick;