using django-email-as-username how can I return with a message to the user? -
i trying utilize django-email-as-username , can't find way homecoming login page message user in case info provided user wrong.
this urls.py
url(r'^login$', 'django.contrib.auth.views.login', {'authentication_form': emailauthenticationform}, name='login'),
this views.py
def login_user(request): if request.method == 'post': email = request.post.get('email') password = request.post.get('password') if email , password: user = authenticate(email=email, password=password) if user: homecoming httpresponseredirect('/') else: message = 'no such user' else: message = 'both email , password required!' else: message = 'wrong method!'
i think you've made error in you're providing own login_user
view in views.py
module, linking django's django.contrib.auth.views.login
in url conf.
you should utilize django.contrib.auth.views.login
login view.
you'll need provide registration/login.html
template. you'll able @ error information, form passed through context. can utilize admin's login template example.
django
No comments:
Post a Comment