forked from geokrety/geokrety-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adduser-2.min.js
1 lines (1 loc) · 3.03 KB
/
adduser-2.min.js
1
var d=!1,e='<img src="https://cdn.geokrety.org/images/icons/exclamation.gif" border="0" />',f="";function h(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var a=document.getElementById("login"),b=document.getElementById("login_img");if(""==a.value)return b.innerHTML=e,i(a),d;b.innerHTML=f;j(a);return!0}window.validateLogin=h; function k(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var a=document.getElementById("haslo1"),b=document.getElementById("haslo1_img");if(5>a.value.length)return b.innerHTML=e,i(a),d;b.innerHTML=f;j(a);var b=document.getElementById("haslo2"),c=document.getElementById("haslo2_img");if(5<=b.value.length){if(a.value!=b.value)return c.innerHTML=e,i(b),d;c.innerHTML=f;j(b)}return!0}window.validatePassword1=k; function l(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var a=document.getElementById("haslo1"),b=document.getElementById("haslo2"),c=document.getElementById("haslo2_img");if(5>a.value.length||5>b.value.length||a.value!=b.value)return c.innerHTML=e,i(b),d;j(a);c.innerHTML=f;j(b);return!0}window.validatePassword2=l; function m(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var a=/^[\S]+\@([\S]+\.)+[A-Za-z]{2,4}$/,b=document.getElementById("email"),c=document.getElementById("email_img"),g=b.value,g=g.replace(/^\s\s*/,""),g=g.replace(/\s\s*$/,"");b.value=g;if(5>=g.length||!g.match(a))return c.innerHTML=e,i(b),d;c.innerHTML=f;j(b);return!0}window.validateEmail=m; function n(a){if(a&&(a=window.event?event.keyCode:a.keyCode,9==a||16<=a&&20>=a||33<=a&&40>=a))return;var a=document.getElementById("captcha"),b=document.getElementById("captcha_img");if(""==a.value)return b.innerHTML=e,i(a),d;b.innerHTML=f;j(a);return!0}window.validateCaptcha=n;function i(a){a.setAttribute("style","border-color: #FF0000;")}window.setBorderColorRed=i;function j(a){a.setAttribute("style","border-color: #666666;")}window.setBorderColorGreen=j; window.validateAddUser=function(){var a;a=!h(null)||d;a=!k(null)||a;a=!l(null)||a;a=!m(null)||a;a=!n(null)||a;return!a}; window.passwordChanged=function(){var a=RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$","g"),b=RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$","g"),c=document.getElementById("haslo1");document.getElementById("strength").innerHTML=0==c.value.length?"":d==RegExp("(?=.{5,}).*","g").test(c.value)?"":a.test(c.value)?' <img src="https://cdn.geokrety.org/images/icons/key.png" alt="key"/> <img src="https://cdn.geokrety.org/images/icons/key.png" alt="key"/> <img src="https://cdn.geokrety.org/images/icons/key.png" alt="key"/> <span style="color:green">Strong!</span>': b.test(c.value)?' <img src="https://cdn.geokrety.org/images/icons/key.png" alt="key"/> <img src="https://cdn.geokrety.org/images/icons/key.png" alt="key"/> <span style="color:orange">Medium!</span>':' <img src="https://cdn.geokrety.org/images/icons/key.png" alt="key"/> <span style="color:red">Weak!</span>'};