aboutsummaryrefslogtreecommitdiff
path: root/static/js
diff options
context:
space:
mode:
authorLibravatar Señor X 2019-04-05 04:53:55 -0300
committerLibravatar Señor X 2019-04-05 04:59:23 -0300
commitd8c40623892877cbae0ecda219ef470c139828da (patch)
treed432e4a74c22a1f82a2ca0cb2d8e00d4364b9f46 /static/js
parent4b78b6399a1cd75a7f686577a23cf60c64975363 (diff)
downloadweabot-d8c40623892877cbae0ecda219ef470c139828da.tar.gz
weabot-d8c40623892877cbae0ecda219ef470c139828da.tar.xz
weabot-d8c40623892877cbae0ecda219ef470c139828da.zip
Contraseñas de posts un poco más complejas
Diffstat (limited to 'static/js')
-rw-r--r--static/js/weabot.js1
-rw-r--r--static/js/weabotxt.js32
2 files changed, 14 insertions, 19 deletions
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<b.length; i++) {
- if (b[i].getAttribute("href") == "/"+board+"/") { b[i].className = "cur_brd"; break; }
+ var main = document.getElementById("main_nav");
+ if (main) {
+ var b = main.getElementsByTagName("a");
+ for(var i=0; i<b.length; i++) {
+ if (b[i].getAttribute("href") == "/"+board+"/") { b[i].className = "cur_brd"; break; }
+ }
}
var forms = document.getElementsByTagName("form");