1 from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateContext, InvalidAuthentication
2 from forms import OpenStreetMapLoginForm
4 class OpenStreetMapAuthConsumer(AuthenticationConsumer):
5 def process_authentication_request(self, request):
6 form_auth = OpenStreetMapLoginForm(request.POST)
8 if form_auth.is_valid():
9 request.session["auth_consumer_data"] = form_auth.get_user_data()
10 return form_auth.get_user()
12 raise InvalidAuthentication(" ".join(form_auth.errors.values()[0]))
14 def get_user_data(self, key):
17 class OpenStreetMapAuthContext(ConsumerTemplateContext):
18 mode = 'TOP_STACK_ITEM'
20 human_name = 'OpenStreetMap Login'
21 stack_item_template = 'modules/osmauth/loginform.html'