| 10582 |
lgm |
1 |
function clearerror(){
|
| 11325 |
lgm |
2 |
|
| 10582 |
lgm |
3 |
if(document.getElementById('error').style.display == 'block')
|
|
|
4 |
document.getElementById('error').style.display = 'none';
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
function signin()
|
|
|
8 |
{
|
| 11325 |
lgm |
9 |
|
| 10582 |
lgm |
10 |
var pass1 = document.getElementById("pwd").value;
|
|
|
11 |
var email = document.getElementById("login-id").value;
|
|
|
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!';
|
|
|
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!';
|
| 10745 |
lgm |
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;}
|
| 10582 |
lgm |
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";
|
| 10981 |
lgm |
53 |
document.getElementById('error').innerHTML ='Password Must be greater than or equal to 6 characters!';
|
| 10582 |
lgm |
54 |
window.scrollTo(0,0); return false;
|
|
|
55 |
}
|
|
|
56 |
if(pass1.length>20)
|
|
|
57 |
{
|
|
|
58 |
document.getElementById('error').style.display = "block";
|
| 10981 |
lgm |
59 |
document.getElementById('error').innerHTML ='Password Must be less than or equal to 20 characters!';
|
| 10582 |
lgm |
60 |
window.scrollTo(0,0); return false;
|
| 10745 |
lgm |
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;}
|
| 11020 |
lgm |
72 |
if(pass1 != pass1.replace(/\s+/g, ''))
|
| 10745 |
lgm |
73 |
{
|
|
|
74 |
document.getElementById('error').style.display = "block";
|
|
|
75 |
document.getElementById('error').innerHTML ='Please remove whitespaces from password!';
|
|
|
76 |
window.scrollTo(0,0); return false;}
|
| 10582 |
lgm |
77 |
}
|
|
|
78 |
|
|
|
79 |
function fbLogin(){
|
|
|
80 |
var url = base_url+'auth/session/facebook';
|
|
|
81 |
window.location.href = url;
|
|
|
82 |
}
|
|
|
83 |
function googleLogin(){
|
|
|
84 |
var url = base_url+'auth/session/google';
|
|
|
85 |
window.location.href = url;
|
|
|
86 |
}
|
|
|
87 |
function forgotPassword(){
|
| 11325 |
lgm |
88 |
|
| 10582 |
lgm |
89 |
if(document.getElementById('forgotpassword').style.display == 'none'){
|
|
|
90 |
document.getElementById('login').style.display = 'none';
|
|
|
91 |
document.getElementById('forgotpassword').style.display = 'block';
|
|
|
92 |
}else if(document.getElementById('forgotpassword').style.display == 'block'){
|
|
|
93 |
var email = document.getElementById('fpEmail').value;
|
|
|
94 |
var atpos = email.indexOf("@");
|
|
|
95 |
var dotpos = email.lastIndexOf(".");
|
|
|
96 |
if(email =='')
|
|
|
97 |
{
|
|
|
98 |
|
|
|
99 |
document.getElementById('error').style.display = "block";
|
|
|
100 |
document.getElementById('error').innerHTML ='Please fill email field!';
|
|
|
101 |
window.scrollTo(0,0); return false;}
|
|
|
102 |
if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length))
|
|
|
103 |
{
|
|
|
104 |
|
|
|
105 |
document.getElementById('error').style.display = "block";
|
|
|
106 |
document.getElementById('error').innerHTML ='Please fill email in correct format!';
|
|
|
107 |
window.scrollTo(0,0); return false;}
|
|
|
108 |
if(email.length> 50)
|
|
|
109 |
{
|
|
|
110 |
|
|
|
111 |
document.getElementById('error').style.display = "block";
|
|
|
112 |
document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
|
| 10745 |
lgm |
113 |
window.scrollTo(0,0); return false;}
|
|
|
114 |
if(!removeScript(email))
|
|
|
115 |
{
|
|
|
116 |
document.getElementById('error').style.display = "block";
|
|
|
117 |
document.getElementById('error').innerHTML ='Please remove script tags!';
|
|
|
118 |
window.scrollTo(0,0); return false;}
|
| 10582 |
lgm |
119 |
var url = base_url+'auth/forgotPassword/'+email;
|
|
|
120 |
microAjax(url,function(res){
|
| 11325 |
lgm |
121 |
|
| 10582 |
lgm |
122 |
if(res != ''){
|
|
|
123 |
var data = JSON.parse(res);
|
|
|
124 |
if(data['response']){
|
|
|
125 |
document.getElementById('error').style.display = "block";
|
|
|
126 |
document.getElementById('error').innerHTML = data['response'].message;
|
|
|
127 |
}
|
|
|
128 |
}
|
|
|
129 |
});
|
|
|
130 |
}
|
|
|
131 |
}
|