aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Señor X 2019-04-05 04:51:13 -0300
committerLibravatar Señor X 2019-04-05 04:51:13 -0300
commit4b78b6399a1cd75a7f686577a23cf60c64975363 (patch)
treec3bcb4f02efae752681beca6679493744561b1a6
parent6e2a0f64d910b6ccb4d09846ea313e3f308fd747 (diff)
downloadweabot-4b78b6399a1cd75a7f686577a23cf60c64975363.tar.gz
weabot-4b78b6399a1cd75a7f686577a23cf60c64975363.tar.xz
weabot-4b78b6399a1cd75a7f686577a23cf60c64975363.zip
Contraseñas de posts un poco más complejas
-rw-r--r--static/js/weabot.js23
1 files 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");