]> git.openstreetmap.org Git - osqa.git/blob - forum_modules/localauth/authentication.py
Configure logging "the Django way" and ensure that all messages are written to the...
[osqa.git] / forum_modules / localauth / authentication.py
1 from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateContext, InvalidAuthentication
2 from forms import ClassicLoginForm
3
4 class LocalAuthConsumer(AuthenticationConsumer):
5     def process_authentication_request(self, request):
6         form_auth = ClassicLoginForm(request.POST)
7
8         if form_auth.is_valid():
9             return form_auth.get_user()
10         else:
11             raise InvalidAuthentication(" ".join(form_auth.errors.values()[0]))
12
13 class LocalAuthContext(ConsumerTemplateContext):
14     mode = 'STACK_ITEM'                      
15     weight = 1000
16     human_name = 'Local authentication'
17     stack_item_template = 'modules/localauth/loginform.html'
18     show_to_logged_in_user = False
19