def login_wrapper(request, template_name='registration/login.html', redirect_field_name=REDIRECT_FIELD_NAME, authentication_form=ExtendedAuthForm, current_app=None, extra_context=None):
 view = appPool.hook_app_index('account_login', request)
 view = filter(None, view)
 if view:
  return view[0]
 if (extra_context is None):
  extra_context = {}
 extra_context.update({'sw_login_version': get_sw_login_version(), 'sw_name': get_sw_name()})
 if (not models.bsdUsers.has_root_password()):
  authentication_form = forms.NewPasswordForm
  extra_context.update({'reset_password': True})
 response = login(request, template_name='registration/login.html', redirect_field_name=redirect_field_name, authentication_form=authentication_form, current_app=current_app, extra_context=extra_context)
 if ((response.status_code in (301, 302)) and (response._headers.get('location', ('', ''))[1] in (reverse('system_reboot'), reverse('system_shutdown'), reverse('account_logout')))):
  response._headers['location'] = ('Location', '/')
 elif request.user.is_authenticated:
  return HttpResponseRedirect('/')
 return response

def login_wrapper ( request , template_name = 'registration/login.html' , redirect_field_name = REDIRECT_FIELD_NAME , authentication_form = ExtendedAuthForm , current_app = None , extra_context = None ) : view = appPool . hook_app_index ( 'account_login' , request ) view = filter ( None , view ) if view : return view [ 0 ] if ( extra_context is None ) : extra_context = { } extra_context . update ( { 'sw_login_version' : get_sw_login_version ( ) , 'sw_name' : get_sw_name ( ) } ) if ( not models . bsdUsers . has_root_password ( ) ) : authentication_form = forms . NewPasswordForm extra_context . update ( { 'reset_password' : True } ) response = login ( request , template_name = 'registration/login.html' , redirect_field_name = redirect_field_name , authentication_form = authentication_form , current_app = current_app , extra_context = extra_context ) if ( ( response . status_code in ( 301 , 302 ) ) and ( response . _headers . get ( 'location' , ( '' , '' ) ) [ 1 ] in ( reverse ( 'system_reboot' ) , reverse ( 'system_shutdown' ) , reverse ( 'account_logout' ) ) ) ) : response . _headers [ 'location' ] = ( 'Location' , '/' ) elif request . user . is_authenticated : return HttpResponseRedirect ( '/' ) return response
wrapper to login to do not allow login and redirect to shutdown .