From 4b78b6399a1cd75a7f686577a23cf60c64975363 Mon Sep 17 00:00:00 2001 From: Señor X Date: Fri, 5 Apr 2019 04:51:13 -0300 Subject: Contraseñas de posts un poco más complejas --- static/js/weabot.js | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/static/js/weabot.js b/static/js/weabot.js index 3fed774..1f8db2e 100644 --- a/static/js/weabot.js +++ b/static/js/weabot.js @@ -3,7 +3,7 @@ var style_cookie = 'weabot_style_ib'; function set_stylesheet(styletitle) { var css=document.getElementById("css"); if(css) { - css.href = "/static/css/" + styletitle.toLowerCase() + ".css"; + css.href="/static/css/" + styletitle.toLowerCase()+".css"; localStorage.setItem(style_cookie, styletitle); } } @@ -216,22 +216,16 @@ function setInputs(id) { } } -function setPassword(id) { - if (document.getElementById(id).password) - with (document.getElementById(id)) if(!password.value) password.value = getPassword("weabot_password"); -} - 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 catSort(type) { @@ -379,7 +373,6 @@ document.addEventListener("DOMContentLoaded", function(e) { if (document.getElementById("postform")) { setInputs("postform"); - setPassword("delform"); maxsize = document.getElementById("maxsize").innerText; types = document.getElementById("filetypes").innerText.split(", "); if (types.includes("JPG")) types.push("JPEG"); -- cgit v1.2.1-18-gbd029