From d8c40623892877cbae0ecda219ef470c139828da Mon Sep 17 00:00:00 2001 From: Señor X Date: Fri, 5 Apr 2019 04:53:55 -0300 Subject: Contraseñas de posts un poco más complejas --- static/js/weabot.js | 1 - static/js/weabotxt.js | 32 ++++++++++++++------------------ 2 files changed, 14 insertions(+), 19 deletions(-) (limited to 'static') diff --git a/static/js/weabot.js b/static/js/weabot.js index 1f8db2e..a79834d 100644 --- a/static/js/weabot.js +++ b/static/js/weabot.js @@ -140,7 +140,6 @@ function expandimg(e) { while(img_cont.lastChild) img_cont.removeChild(img_cont.lastChild); img_cont.appendChild(new_img); - e.preventDefault(); } } diff --git a/static/js/weabotxt.js b/static/js/weabotxt.js index 5cf205e..670ce50 100644 --- a/static/js/weabotxt.js +++ b/static/js/weabotxt.js @@ -7,7 +7,7 @@ var hiddenposts = Array(); function set_stylesheet(styletitle) { var css=document.getElementById("css"); - if(css) css.href = "/static/css/txt/"+styletitle.toLowerCase()+".css"; + if(css) css.href="/static/css/txt/"+styletitle.toLowerCase()+".css"; localStorage.setItem(style_cookie,styletitle); } @@ -25,15 +25,14 @@ if (!Array.prototype.indexOf) { function getPassword() { if (weabot.password) return weabot.password; - var char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - var pass=""; - for (var i=0;i<8;i++) { - var rnd = Math.floor(Math.random()*char.length); - pass += char.substring(rnd, rnd+1); - } - weabot.password = pass; + var pass=""; + var char="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789?!-_."; + while (pass.length<10) { + pass += char[Math.floor(Math.random()*char.length)]; + } + weabot.password = pass; localStorage.setItem("weabot", JSON.stringify(weabot)); - return(pass); + return(pass); } function saveInputs(e) { @@ -56,12 +55,6 @@ function setInputs(id) { } } -function setPassword(id) { - if (document.getElementById(id).password) - with (document.getElementById(id)) - if(!password.value) password.value = getPassword("weabot_password"); -} - // Textboard data function insert(text) { var textarea=document.forms.postform.message; @@ -210,9 +203,12 @@ document.addEventListener("DOMContentLoaded", function() { else weabot = {"name":null,"email":null,"password":null}; board = document.body.dataset.brd; - var b = document.getElementById("main_nav").getElementsByTagName("a"); - for(var i=0; i