scratch
//text.html |
@@ -160,7 +160,7 @@ |
// Set the nick as a cookie. |
const fingerprint = result; |
var nick = Cookies.get('nick'); |
if(!nick || nick.length !== 32) { |
if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick)) { |
Cookies.set('nick', result, { path: '' }); |
nick = result; |
} |
@@ -278,7 +278,7 @@ |
// When the button is clicked, navigate to the fingerprint. |
$('#go').click(() => { |
nick = $('#nick').val(); |
if(!nick || nick.length != 32) |
if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick)) |
return; |
Cookies.set('nick', nick, { path: '' }); |
result = nick; |
@@ -312,7 +312,7 @@ |
e.preventDefault(); |
|
nick = $('#nick').val(); |
if(!nick || nick.length != 32) |
if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick)) |
return; |
Cookies.set('nick', nick, { path: '' }); |
result = nick; |
@@ -344,7 +344,7 @@ |
// While the nick is changing, navigate to the changed fingerprint. |
$("#nick").on('input', () => { |
nick = $('#nick').val(); |
if(!nick || nick.length != 32) |
if(!nick || !/^[A-Za-z0-9]{32}$/.test(nick)) |
return; |
Cookies.set('nick', nick, { path: '' }); |
result = nick; |