aboutsummaryrefslogtreecommitdiff
path: root/static/js/weabot.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/weabot.js')
-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");