1 from forum.authentication.base import AuthenticationConsumer, ConsumerTemplateContext, InvalidAuthentication
 
   2 from forms import ClassicLoginForm
 
   4 class LocalAuthConsumer(AuthenticationConsumer):
 
   5     def process_authentication_request(self, request):
 
   6         form_auth = ClassicLoginForm(request.POST)
 
   8         if form_auth.is_valid():
 
   9             return form_auth.get_user()
 
  11             raise InvalidAuthentication(" ".join(form_auth.errors.values()[0]))
 
  13 class LocalAuthContext(ConsumerTemplateContext):
 
  16     human_name = 'Local authentication'
 
  17     stack_item_template = 'modules/localauth/loginform.html'
 
  18     show_to_logged_in_user = False