forked from geokrety/geokrety-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
adduser-1.min.js
8 lines (8 loc) · 3.08 KB
/
adduser-1.min.js
1
2
3
4
5
6
7
8
var e=false,f='<img src="https://cdn.geokrety.org/images/icons/exclamation.gif" border="0" />',g="";function h(a){if(a){a=window.event?event.keyCode:a.keyCode;if(a==9||a>=16&&a<=20||a>=33&&a<=40)return}a=document.getElementById("login");var b=document.getElementById("login_img");if(a.value==""){b.innerHTML=f;i(a);return e}b.innerHTML=g;j(a);return true}window.validateLogin=h;
function k(a){if(a){a=window.event?event.keyCode:a.keyCode;if(a==9||a>=16&&a<=20||a>=33&&a<=40)return}a=document.getElementById("haslo1");var b=document.getElementById("haslo1_img");if(a.value.length<5){b.innerHTML=f;i(a);return e}b.innerHTML=g;j(a);b=document.getElementById("haslo2");var d=document.getElementById("haslo2_img");if(b.value.length>=5)if(a.value!=b.value){d.innerHTML=f;i(b);return e}else{d.innerHTML=g;j(b)}return true}window.validatePassword1=k;
function l(a){if(a){a=window.event?event.keyCode:a.keyCode;if(a==9||a>=16&&a<=20||a>=33&&a<=40)return}a=document.getElementById("haslo1");var b=document.getElementById("haslo2"),d=document.getElementById("haslo2_img");if(a.value.length<5||b.value.length<5||a.value!=b.value){d.innerHTML=f;i(b);return e}j(a);d.innerHTML=g;j(b);return true}window.validatePassword2=l;
function m(a){if(a){a=window.event?event.keyCode:a.keyCode;if(a==9||a>=16&&a<=20||a>=33&&a<=40)return}a=/^[\S]+\@([\S]+\.)+[A-Za-z]{2,4}$/;var b=document.getElementById("email"),d=document.getElementById("email_img"),c=b.value;c=c.replace(/^\s\s*/,"");c=c.replace(/\s\s*$/,"");b.value=c;if(c.length<=5||!c.match(a)){d.innerHTML=f;i(b);return e}d.innerHTML=g;j(b);return true}window.validateEmail=m;
function n(a){if(a){a=window.event?event.keyCode:a.keyCode;if(a==9||a>=16&&a<=20||a>=33&&a<=40)return}a=document.getElementById("captcha");var b=document.getElementById("captcha_img");if(a.value==""){b.innerHTML=f;i(a);return e}b.innerHTML=g;j(a);return true}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=e;a=!h(null)||a;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"),d=RegExp("(?=.{5,}).*","g"),c=document.getElementById("haslo1");document.getElementById("strength").innerHTML=c.value.length==0?"":e==d.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>'};