48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
+
+
|
self.domain = domain
self.token_url = url
self.language = language
self.profile = None
self.prompt = prompt
self.on_login_failure = on_login_failure
self.mappings = Storage()
self.mappings.Facebook = lambda profile:\
dn = {'givenName':'','familyName':''}
self.mappings.Facebook = lambda profile, dn=dn:\
dict(registration_id = profile.get("identifier",""),
username = profile.get("preferredUsername",""),
email = profile.get("email",""),
first_name = profile.get("name","").get("givenName",""),
last_name = profile.get("name","").get("familyName",""))
self.mappings.Google = lambda profile:\
email = profile.get("email",""),
first_name = profile.get("name",dn).get("givenName",""),
last_name = profile.get("name",dn).get("familyName",""))
self.mappings.Google = lambda profile, dn=dn:\
dict(registration_id=profile.get("identifier",""),
username=profile.get("preferredUsername",""),
email=profile.get("email",""),
first_name=profile.get("name","").get("givenName",""),
last_name=profile.get("name","").get("familyName",""))
first_name=profile.get("name",dn).get("givenName",""),
last_name=profile.get("name",dn).get("familyName",""))
self.mappings.default = lambda profile:\
dict(registration_id=profile.get("identifier",""),
username=profile.get("preferredUsername",""),
email=profile.get("email",""),
first_name=profile.get("preferredUsername",""),
last_name='')
|
107
108
109
110
111
112
113
|
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
|
+
+
+
+
+
+
+
+
+
+
+
+
|
SCRIPT("RPXNOW.overlay = true;",
"RPXNOW.language_preference = '%s';" % self.language,
"RPXNOW.realm = '%s';" % self.domain,
"RPXNOW.token_url = '%s';" % self.token_url,
"RPXNOW.show();",
_type="text/javascript"))
return rpxform
def use_janrain(auth,filename='private/janrain.key',**kwargs):
path = os.path.join(current.request.folder,filename)
if os.path.exists(path):
request = current.request
domain,key = open(path,'r').read().strip().split(':')
host = current.request.env.http_host
url = "http://%s/%s/default/user/login" % (host,request.application)
auth.settings.actions_disabled = \
['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(
request, api_key=key,domain=domain, url = url,**kwargs)
|