Subversion Repositories SmartDukaan

Rev

Rev 7007 | Rev 7825 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7007 Rev 7039
Line 27... Line 27...
27
				minlength: 6,
27
				minlength: 6,
28
				maxlength: 20
28
				maxlength: 20
29
			}
29
			}
30
		}
30
		}
31
	});
31
	});
32
	
-
 
33
});
-
 
34
 
-
 
35
function loginToSaholicByFacebook(userDetails, authResponse){
-
 
36
	var longLivedToken = null;
-
 
37
	
-
 
38
	if(authResponse!==null) {
-
 
39
		$.ajax({
-
 
40
			type	: "GET",
-
 
41
			url		: "https://graph.facebook.com/oauth/access_token?grant_type=fb_exchange_token&client_id="+
-
 
42
					   '${in.shop2020.appId}' + "&client_secret="+'${in.shop2020.appSecret}'+
-
 
43
					  "&fb_exchange_token="+authResponse.accessToken,
-
 
44
	
-
 
45
			success	: function(response) {
-
 
46
				longLivedToken = response.substring(0,response.indexOf("&expires")).split("=")[1];
-
 
47
			},
-
 
48
			
-
 
49
			complete: function() {
-
 
50
				$.ajax({
-
 
51
					type : "POST",
-
 
52
					url : "/login/?email="+userDetails.email+"&name="+userDetails.name+"&gender="+userDetails.gender+"&isFacebookUser=True&accessToken="+longLivedToken+"&facebookId="+authResponse.userID,
-
 
53
					success : function(response) {
-
 
54
						window.location = "/";
-
 
55
					}
-
 
56
				});
-
 
57
			}
-
 
58
			
-
 
59
		});
-
 
60
	} else {
-
 
61
		$.ajax({
-
 
62
			type : "POST",
-
 
63
			url : "/login/?email="+userDetails.email+"&name="+userDetails.name+"&gender="+userDetails.gender+"&isFacebookUser=True",
-
 
64
			success : function(response) {
-
 
65
				window.location = "/";
-
 
66
			}
-
 
67
		});
-
 
68
	}
-
 
69
}
-
 
70
32
});
-
 
33
71
34