| Line 1... |
Line 1... |
| 1 |
function clearerror(){
|
1 |
function clearerror(){if(document.getElementById("error").style.display=="block"){document.getElementById("error").style.display="none";}}function signin(){var pass1=document.getElementById("pwd").value;var email=document.getElementById("login-id").value;var atpos=email.indexOf("@");var dotpos=email.lastIndexOf(".");if(email==""){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please fill email field!";window.scrollTo(0,0);return false;}if((atpos<1)||(dotpos<atpos+2)||(dotpos+2>=email.length)){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please fill email in correct format!";window.scrollTo(0,0);return false;}if(email.length>50){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please enter less than 50 characters in email field!";window.scrollTo(0,0);return false;}if(!removeScript(email)){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please remove script tags!";window.scrollTo(0,0);return false;}if(pass1==""){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please fill password field!";window.scrollTo(0,0);return false;}if(pass1.length<6){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Password Must be greater than or equal to 6 characters!";window.scrollTo(0,0);return false;}if(pass1.length>20){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Password Must be less than or equal to 20 characters!";window.scrollTo(0,0);return false;}if(!removeScript(pass1)){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please remove script tags!";window.scrollTo(0,0);return false;}if(pass1!=pass1.trim()){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please remove excess whitespaces from password!";window.scrollTo(0,0);return false;}if(pass1!=pass1.replace(/\s+/g,"")){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please remove whitespaces from password!";window.scrollTo(0,0);return false;}}function fbLogin(){var url=base_url+"auth/session/facebook";window.location.href=url;}function googleLogin(){var url=base_url+"auth/session/google";window.location.href=url;}function forgotPassword(){if(document.getElementById("forgotpassword").style.display=="none"){document.getElementById("login").style.display="none";document.getElementById("forgotpassword").style.display="block";}else{if(document.getElementById("forgotpassword").style.display=="block"){var email=document.getElementById("fpEmail").value;var atpos=email.indexOf("@");var dotpos=email.lastIndexOf(".");if(email==""){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please fill email field!";window.scrollTo(0,0);return false;}if((atpos<1)||(dotpos<atpos+2)||(dotpos+2>=email.length)){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please fill email in correct format!";window.scrollTo(0,0);return false;}if(email.length>50){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please enter less than 50 characters in email field!";window.scrollTo(0,0);return false;}if(!removeScript(email)){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML="Please remove script tags!";window.scrollTo(0,0);return false;}var url=base_url+"auth/forgotPassword/"+email;microAjax(url,function(res){if(res!=""){var data=JSON.parse(res);if(data["response"]){document.getElementById("error").style.display="block";document.getElementById("error").innerHTML=data["response"].message;}}});}}}
|
| 2 |
|
- |
|
| 3 |
if(document.getElementById('error').style.display == 'block')
|
- |
|
| 4 |
document.getElementById('error').style.display = 'none';
|
- |
|
| 5 |
}
|
- |
|
| 6 |
|
2 |
|
| 7 |
function signin()
|
- |
|
| 8 |
{
|
- |
|
| 9 |
|
- |
|
| 10 |
var pass1 = document.getElementById("pwd").value;
|
- |
|
| 11 |
var email = document.getElementById("login-id").value;
|
3 |
var pheight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
|
| 12 |
//var server = document.getElementById('servererror');
|
- |
|
| 13 |
var atpos = email.indexOf("@");
|
- |
|
| 14 |
var dotpos = email.lastIndexOf(".");
|
- |
|
| 15 |
if(email =='')
|
- |
|
| 16 |
{
|
- |
|
| 17 |
|
- |
|
| 18 |
document.getElementById('error').style.display = "block";
|
- |
|
| 19 |
document.getElementById('error').innerHTML ='Please fill email field!';
|
4 |
if (document.getElementsByClassName("change-password")[0] != undefined) {
|
| 20 |
window.scrollTo(0,0); return false;}
|
- |
|
| 21 |
if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length))
|
- |
|
| 22 |
{
|
- |
|
| 23 |
|
- |
|
| 24 |
document.getElementById('error').style.display = "block";
|
- |
|
| 25 |
document.getElementById('error').innerHTML ='Please fill email in correct format!';
|
- |
|
| 26 |
window.scrollTo(0,0); return false;
|
- |
|
| 27 |
}
|
- |
|
| 28 |
if(email.length> 50)
|
- |
|
| 29 |
{
|
- |
|
| 30 |
|
- |
|
| 31 |
document.getElementById('error').style.display = "block";
|
- |
|
| 32 |
document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
|
- |
|
| 33 |
window.scrollTo(0,0); return false;}
|
- |
|
| 34 |
if(!removeScript(email))
|
- |
|
| 35 |
{
|
- |
|
| 36 |
document.getElementById('error').style.display = "block";
|
- |
|
| 37 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
- |
|
| 38 |
window.scrollTo(0,0); return false;}
|
- |
|
| 39 |
if(pass1 =='')
|
- |
|
| 40 |
{
|
- |
|
| 41 |
document.getElementById('error').style.display = "block";
|
- |
|
| 42 |
document.getElementById('error').innerHTML ='Please fill password field!';
|
- |
|
| 43 |
window.scrollTo(0,0); return false;}
|
- |
|
| 44 |
// if(!pass1.match(/^[A-Za-z0-9 ]{1,50}$/))
|
- |
|
| 45 |
// {
|
- |
|
| 46 |
// document.getElementById('error').style.display = "block";
|
- |
|
| 47 |
// document.getElementById('error').innerHTML ='Please fill alphabets and numbers only in password field!';
|
- |
|
| 48 |
// window.scrollTo(0,0); return false;}
|
- |
|
| 49 |
if(pass1.length<6)
|
- |
|
| 50 |
{
|
- |
|
| 51 |
|
- |
|
| 52 |
document.getElementById('error').style.display = "block";
|
- |
|
| 53 |
document.getElementById('error').innerHTML ='Password Must be greater than or equal to 6 characters!';
|
- |
|
| 54 |
window.scrollTo(0,0); return false;
|
- |
|
| 55 |
}
|
- |
|
| 56 |
if(pass1.length>20)
|
- |
|
| 57 |
{
|
- |
|
| 58 |
document.getElementById('error').style.display = "block";
|
- |
|
| 59 |
document.getElementById('error').innerHTML ='Password Must be less than or equal to 20 characters!';
|
- |
|
| 60 |
window.scrollTo(0,0); return false;
|
- |
|
| 61 |
}
|
- |
|
| 62 |
if(!removeScript(pass1))
|
- |
|
| 63 |
{
|
- |
|
| 64 |
document.getElementById('error').style.display = "block";
|
- |
|
| 65 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
- |
|
| 66 |
window.scrollTo(0,0); return false;}
|
- |
|
| 67 |
if(pass1 != pass1.trim())
|
- |
|
| 68 |
{
|
- |
|
| 69 |
document.getElementById('error').style.display = "block";
|
- |
|
| 70 |
document.getElementById('error').innerHTML ='Please remove excess whitespaces from password!';
|
- |
|
| 71 |
window.scrollTo(0,0); return false;}
|
- |
|
| 72 |
if(pass1 != pass1.replace(/\s+/g, ''))
|
- |
|
| 73 |
{
|
- |
|
| 74 |
document.getElementById('error').style.display = "block";
|
- |
|
| 75 |
document.getElementById('error').innerHTML ='Please remove whitespaces from password!';
|
5 |
document.getElementsByClassName("change-password")[0].style.minHeight = pheight - 235 + "px";
|
| 76 |
window.scrollTo(0,0); return false;}
|
- |
|
| 77 |
}
|
6 |
}
|
| 78 |
|
7 |
|
| 79 |
function fbLogin(){
|
- |
|
| 80 |
var url = base_url+'auth/session/facebook';
|
- |
|
| 81 |
window.location.href = url;
|
- |
|
| 82 |
}
|
8 |
|
| 83 |
function googleLogin(){
|
- |
|
| 84 |
var url = base_url+'auth/session/google';
|
9 |
var action = document.getElementById('save_btn');
|
| 85 |
window.location.href = url;
|
- |
|
| 86 |
}
|
10 |
|
| 87 |
function forgotPassword(){
|
- |
|
| 88 |
|
11 |
|
| 89 |
if(document.getElementById('forgotpassword').style.display == 'none'){
|
- |
|
| 90 |
document.getElementById('login').style.display = 'none';
|
12 |
action.addEventListener('click',validate, false);
|
| 91 |
document.getElementById('forgotpassword').style.display = 'block';
|
- |
|
| 92 |
}else if(document.getElementById('forgotpassword').style.display == 'block'){
|
- |
|
| - |
|
13 |
|
| 93 |
var email = document.getElementById('fpEmail').value;
|
14 |
var count = document.getElementsByClassName('pass').length;
|
| 94 |
var atpos = email.indexOf("@");
|
15 |
var submit = true;
|
| 95 |
var dotpos = email.lastIndexOf(".");
|
- |
|
| - |
|
16 |
|
| - |
|
17 |
|
| - |
|
18 |
|
| 96 |
if(email =='')
|
19 |
function validate(){
|
| 97 |
{
|
20 |
submit = true;
|
| 98 |
|
21 |
for(var i=0;i<count;i++){
|
| - |
|
22 |
if(document.getElementsByClassName('pass')[i].value == ''){
|
| 99 |
document.getElementById('error').style.display = "block";
|
23 |
document.getElementById('error-message').style.display = 'block';
|
| 100 |
document.getElementById('error').innerHTML ='Please fill email field!';
|
24 |
document.getElementById('error-message').innerHTML = 'Password field should not be empty';
|
| 101 |
window.scrollTo(0,0); return false;}
|
25 |
submit = false;
|
| 102 |
if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length))
|
- |
|
| 103 |
{
|
26 |
break;
|
| 104 |
|
27 |
}else{
|
| - |
|
28 |
if((document.getElementById('new-pass').value.length < 6) || (document.getElementById('confirm-pass').value.length < 6)){
|
| 105 |
document.getElementById('error').style.display = "block";
|
29 |
document.getElementById('error-message').style.display = 'block';
|
| 106 |
document.getElementById('error').innerHTML ='Please fill email in correct format!';
|
30 |
document.getElementById('error-message').innerHTML = "Password length should be minimum 6 characters long!";
|
| 107 |
window.scrollTo(0,0); return false;}
|
- |
|
| 108 |
if(email.length> 50)
|
31 |
submit = false;
|
| 109 |
{
|
- |
|
| 110 |
|
32 |
break;
|
| 111 |
document.getElementById('error').style.display = "block";
|
- |
|
| 112 |
document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
|
33 |
} else if(document.getElementById('new-pass').value != document.getElementById('confirm-pass').value){
|
| 113 |
window.scrollTo(0,0); return false;}
|
- |
|
| 114 |
if(!removeScript(email))
|
- |
|
| 115 |
{
|
- |
|
| 116 |
document.getElementById('error').style.display = "block";
|
34 |
document.getElementById('error-message').style.display = 'block';
|
| 117 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
35 |
document.getElementById('error-message').innerHTML = "Confirm password doesn't match with new password! ";
|
| 118 |
window.scrollTo(0,0); return false;}
|
- |
|
| 119 |
var url = base_url+'auth/forgotPassword/'+email;
|
- |
|
| 120 |
microAjax(url,function(res){
|
- |
|
| 121 |
|
- |
|
| 122 |
if(res != ''){
|
- |
|
| 123 |
var data = JSON.parse(res);
|
36 |
submit = false;
|
| 124 |
if(data['response']){
|
37 |
break;
|
| 125 |
document.getElementById('error').style.display = "block";
|
- |
|
| 126 |
document.getElementById('error').innerHTML = data['response'].message;
|
- |
|
| 127 |
}
|
38 |
}
|
| 128 |
}
|
39 |
}
|
| - |
|
40 |
}
|
| - |
|
41 |
|
| - |
|
42 |
if(submit != false){
|
| - |
|
43 |
document.getElementsByTagName('form')[0].submit();
|
| 129 |
});
|
44 |
}
|
| - |
|
45 |
|
| - |
|
46 |
setTimeout(function(){
|
| - |
|
47 |
document.getElementById('error-message').style.display = 'none';
|
| - |
|
48 |
},3000);
|
| - |
|
49 |
}
|
| - |
|
50 |
|
| - |
|
51 |
var cancel = document.getElementById('cancel_btn');
|
| - |
|
52 |
cancel.addEventListener('click',validate1, false);
|
| - |
|
53 |
|
| - |
|
54 |
function validate1(){
|
| - |
|
55 |
for(var i=0;i<count;i++){
|
| - |
|
56 |
document.getElementsByClassName('pass')[i].value = '';
|
| 130 |
}
|
57 |
}
|
| 131 |
}
|
- |
|
| 132 |
|
58 |
}
|
| - |
|
59 |
|
| - |
|
60 |
|
| - |
|
61 |
setTimeout(function(){
|
| - |
|
62 |
document.getElementById('error-message').style.display = 'none';
|
| - |
|
63 |
if(document.getElementsByClassName('success_msg')[0] != undefined){
|
| - |
|
64 |
document.getElementsByClassName('success_msg')[0].style.display = 'none';
|
| - |
|
65 |
}
|
| - |
|
66 |
},3000);
|
| - |
|
67 |
|
| 133 |
|
68 |
|