django-axes with custom user model -


i’ve been struggling include django-axes project i’m using custom user model. finally, got working. “almost” because none errors shown, unfortunately django-axes not catching failed login attempts.

in fact, showing in admin user got logged (and, therefore, user never logout). think i'm getting same problem indicated here: django-axes not working custom login view

i’ll show parts of code, maybe shed light issue. in advance

urls.py

from axes.decorators import watch_login apps.main.views import userlogin urlpatterns = patterns(‘',      url(r'^login/$', watch_login(userlogin), name="login"), 

views.py

    axes.decorators import watch_login      @watch_login     def userlogin(request):         if request.method == "post":             if 'login_form' in request.post:                 username = request.post.get('username', '')                 password = request.post.get('password', '')                 user = authenticate(username=username, password=password)                 if user not none: # user exists, credentials ok                     if user.is_active:                         login(request, user) # log user                         if not request.post.get('rememberuser', none):                              request.session.set_expiry(3600)                      else:                         return redirect('users_app:disabled_account')                 else:                     return redirect('users_app:login_failed')         return redirect('main_app:index')      def logout(request):         logout(request)         return redirect('/‘)      class incorrectloginview(templateview):         template_name = 'users/login_failed.html' 

base.py

middleware_clases = (    'da_tracker.middleware.trackermiddleware', ) 


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -