]> git.openstreetmap.org Git - osqa.git/blob - forum_modules/openidauth/authentication.py
Remove ADMIN_MEDIA_PREFIX since it has been deprecated in Django 1.4
[osqa.git] / forum_modules / openidauth / authentication.py
1 from consumer import OpenIdAbstractAuthConsumer
2 from forum.authentication.base import ConsumerTemplateContext
3
4 class GoogleAuthConsumer(OpenIdAbstractAuthConsumer):
5     def get_user_url(self, request):
6         return 'https://www.google.com/accounts/o8/id'
7
8 class GoogleAuthContext(ConsumerTemplateContext):
9     mode = 'BIGICON'
10     type = 'DIRECT'
11     weight = 200
12     human_name = 'Google'
13     icon = '/media/images/openid/google.gif'
14
15
16
17 class YahooAuthConsumer(OpenIdAbstractAuthConsumer):
18     def get_user_url(self, request):
19         return 'http://me.yahoo.com/'
20
21 class YahooAuthContext(ConsumerTemplateContext):
22     mode = 'BIGICON'
23     type = 'DIRECT'
24     weight = 300
25     human_name = 'Yahoo'
26     icon = '/media/images/openid/yahoo.gif'
27
28
29
30 class AolAuthConsumer(OpenIdAbstractAuthConsumer):
31     def get_user_url(self, request):
32         uname = request.POST['input_field']
33         return 'http://openid.aol.com/' + uname
34
35 class AolAuthContext(ConsumerTemplateContext):
36     mode = 'SMALLICON'
37     type = 'SIMPLE_FORM'
38     simple_form_context = {
39         'your_what': 'AOL screen name'
40     }
41     weight = 200
42     human_name = 'AOL'
43     icon = '/media/images/openid/aol.png'
44
45
46 class MyOpenIdAuthConsumer(OpenIdAbstractAuthConsumer):
47     dataype2ax_schema = {
48         #'username': ('http://schema.openid.net/namePerson/friendly', 'friendly'),
49         'email': 'http://schema.openid.net/contact/email',
50         #'web': 'http://schema.openid.net/contact/web/default',
51         #'birthdate': ('http://schema.openid.net/birthDate', 'birthDate'),
52     }
53
54     def get_user_url(self, request):
55         blog_name = request.POST['input_field']
56         return "http://%s.myopenid.com/" % blog_name
57
58 class MyOpenIdAuthContext(ConsumerTemplateContext):
59     mode = 'BIGICON'
60     type = 'SIMPLE_FORM'
61     simple_form_context = {
62         'your_what': 'MyOpenID user name'
63     }
64     weight = 400
65     human_name = 'MyOpenID'
66     icon = '/media/images/openid/myopenid_big.png'
67
68
69 class FlickrAuthConsumer(OpenIdAbstractAuthConsumer):
70     def get_user_url(self, request):
71         blog_name = request.POST['input_field']
72         return "http://flickr.com/%s/" % blog_name
73
74 class FlickrAuthContext(ConsumerTemplateContext):
75     mode = 'SMALLICON'
76     type = 'SIMPLE_FORM'
77     simple_form_context = {
78         'your_what': 'Flickr user name'
79     }
80     weight = 250
81     human_name = 'Flickr'
82     icon = '/media/images/openid/flickr.png'
83
84
85 class TechnoratiAuthConsumer(OpenIdAbstractAuthConsumer):
86     def get_user_url(self, request):
87         blog_name = request.POST['input_field']
88         return "http://technorati.com/people/technorati/%s/" % blog_name
89
90 class TechnoratiAuthContext(ConsumerTemplateContext):
91     mode = 'SMALLICON'
92     type = 'SIMPLE_FORM'
93     simple_form_context = {
94         'your_what': 'Technorati user name'
95     }
96     weight = 260
97     human_name = 'Technorati'
98     icon = '/media/images/openid/technorati.png'
99
100
101 class WordpressAuthConsumer(OpenIdAbstractAuthConsumer):
102     def get_user_url(self, request):
103         blog_name = request.POST['input_field']
104         return "http://%s.wordpress.com/" % blog_name
105
106 class WordpressAuthContext(ConsumerTemplateContext):
107     mode = 'SMALLICON'
108     type = 'SIMPLE_FORM'
109     simple_form_context = {
110         'your_what': 'Wordpress blog name'
111     }
112     weight = 270
113     human_name = 'Wordpress'
114     icon = '/media/images/openid/wordpress.png'
115
116
117 class BloggerAuthConsumer(OpenIdAbstractAuthConsumer):
118     def get_user_url(self, request):
119         blog_name = request.POST['input_field']
120         return "http://%s.blogspot.com/" % blog_name
121
122 class BloggerAuthContext(ConsumerTemplateContext):
123     mode = 'SMALLICON'
124     type = 'SIMPLE_FORM'
125     simple_form_context = {
126         'your_what': 'Blogger blog name'
127     }
128     weight = 300
129     human_name = 'Blogger'
130     icon = '/media/images/openid/blogger.png'
131
132
133 class LiveJournalAuthConsumer(OpenIdAbstractAuthConsumer):
134     def get_user_url(self, request):
135         blog_name = request.POST['input_field']
136         return "http://%s.livejournal.com/" % blog_name
137
138 class LiveJournalAuthContext(ConsumerTemplateContext):
139     mode = 'SMALLICON'
140     type = 'SIMPLE_FORM'
141     simple_form_context = {
142         'your_what': 'LiveJournal blog name'
143     }
144     weight = 310
145     human_name = 'LiveJournal'
146     icon = '/media/images/openid/livejournal.png'
147
148
149 class ClaimIdAuthConsumer(OpenIdAbstractAuthConsumer):
150     def get_user_url(self, request):
151         blog_name = request.POST['input_field']
152         return "http://claimid.com/%s" % blog_name
153
154 class ClaimIdAuthContext(ConsumerTemplateContext):
155     mode = 'SMALLICON'
156     type = 'SIMPLE_FORM'
157     simple_form_context = {
158         'your_what': 'ClaimID user name'
159     }
160     weight = 320
161     human_name = 'ClaimID'
162     icon = '/media/images/openid/claimid.png'
163
164 class VerisignAuthConsumer(OpenIdAbstractAuthConsumer):
165     def get_user_url(self, request):
166         blog_name = request.POST['input_field']
167         return "http://%s.pip.verisignlabs.com/" % blog_name
168
169 class VerisignAuthContext(ConsumerTemplateContext):
170     mode = 'SMALLICON'
171     type = 'SIMPLE_FORM'
172     simple_form_context = {
173         'your_what': 'Verisign user name'
174     }
175     weight = 340
176     human_name = 'Verisign'
177     icon = '/media/images/openid/verisign.png'
178
179     
180 class OpenIdUrlAuthConsumer(OpenIdAbstractAuthConsumer):
181     pass
182
183 class OpenIdUrlAuthContext(ConsumerTemplateContext):
184     mode = 'STACK_ITEM'
185     weight = 300
186     human_name = 'OpenId url'
187     stack_item_template = 'modules/openidauth/openidurl.html'
188     icon = '/media/images/openid/openid-inputicon.gif'