| 10582 |
lgm |
1 |
function clearerror(){
|
|
|
2 |
debugger;
|
|
|
3 |
if(document.getElementById('error').style.display == 'block')
|
|
|
4 |
document.getElementById('error').style.display = 'none';
|
|
|
5 |
}
|
|
|
6 |
|
|
|
7 |
function signin()
|
|
|
8 |
{
|
|
|
9 |
debugger;
|
|
|
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!';
|
|
|
33 |
window.scrollTo(0,0); return false;}
|
|
|
34 |
if(pass1 =='')
|
|
|
35 |
{
|
|
|
36 |
document.getElementById('error').style.display = "block";
|
|
|
37 |
document.getElementById('error').innerHTML ='Please fill password field!';
|
|
|
38 |
window.scrollTo(0,0); return false;}
|
|
|
39 |
// if(!pass1.match(/^[A-Za-z0-9 ]{1,50}$/))
|
|
|
40 |
// {
|
|
|
41 |
// document.getElementById('error').style.display = "block";
|
|
|
42 |
// document.getElementById('error').innerHTML ='Please fill alphabets and numbers only in password field!';
|
|
|
43 |
// window.scrollTo(0,0); return false;}
|
|
|
44 |
if(pass1.length<6)
|
|
|
45 |
{
|
|
|
46 |
|
|
|
47 |
document.getElementById('error').style.display = "block";
|
|
|
48 |
document.getElementById('error').innerHTML ='Password Must be greater than equal to 6 characters!';
|
|
|
49 |
window.scrollTo(0,0); return false;
|
|
|
50 |
}
|
|
|
51 |
if(pass1.length>20)
|
|
|
52 |
{
|
|
|
53 |
document.getElementById('error').style.display = "block";
|
|
|
54 |
document.getElementById('error').innerHTML ='Password Must be less than equal to 20 characters!';
|
|
|
55 |
window.scrollTo(0,0); return false;
|
|
|
56 |
}
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
function fbLogin(){
|
|
|
60 |
var url = base_url+'auth/session/facebook';
|
|
|
61 |
window.location.href = url;
|
|
|
62 |
}
|
|
|
63 |
function googleLogin(){
|
|
|
64 |
var url = base_url+'auth/session/google';
|
|
|
65 |
window.location.href = url;
|
|
|
66 |
}
|
|
|
67 |
function forgotPassword(){
|
|
|
68 |
debugger;
|
|
|
69 |
if(document.getElementById('forgotpassword').style.display == 'none'){
|
|
|
70 |
document.getElementById('login').style.display = 'none';
|
|
|
71 |
document.getElementById('forgotpassword').style.display = 'block';
|
|
|
72 |
}else if(document.getElementById('forgotpassword').style.display == 'block'){
|
|
|
73 |
var email = document.getElementById('fpEmail').value;
|
|
|
74 |
var atpos = email.indexOf("@");
|
|
|
75 |
var dotpos = email.lastIndexOf(".");
|
|
|
76 |
if(email =='')
|
|
|
77 |
{
|
|
|
78 |
|
|
|
79 |
document.getElementById('error').style.display = "block";
|
|
|
80 |
document.getElementById('error').innerHTML ='Please fill email field!';
|
|
|
81 |
window.scrollTo(0,0); return false;}
|
|
|
82 |
if((atpos<1) || (dotpos < atpos+2) || (dotpos+2 >= email.length))
|
|
|
83 |
{
|
|
|
84 |
|
|
|
85 |
document.getElementById('error').style.display = "block";
|
|
|
86 |
document.getElementById('error').innerHTML ='Please fill email in correct format!';
|
|
|
87 |
window.scrollTo(0,0); return false;}
|
|
|
88 |
if(email.length> 50)
|
|
|
89 |
{
|
|
|
90 |
|
|
|
91 |
document.getElementById('error').style.display = "block";
|
|
|
92 |
document.getElementById('error').innerHTML ='Please enter less than 50 characters in email field!';
|
|
|
93 |
window.scrollTo(0,0); return false;}
|
|
|
94 |
var url = base_url+'auth/forgotPassword/'+email;
|
|
|
95 |
microAjax(url,function(res){
|
|
|
96 |
debugger;
|
|
|
97 |
if(res != ''){
|
|
|
98 |
var data = JSON.parse(res);
|
|
|
99 |
if(data['response']){
|
|
|
100 |
document.getElementById('error').style.display = "block";
|
|
|
101 |
document.getElementById('error').innerHTML = data['response'].message;
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
});
|
|
|
105 |
}
|
|
|
106 |
}
|