Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def connexion(request):
- form = AuthenticationForm(request.POST)
- if request.method == 'POST':
- print form.errors
- if form.is_valid():
- username = form.cleaned_data['username']
- password = form.cleaned_data['password']
- user = authenticate(username=username, password=password)
- if user is not None:
- message = "Utilisateur reconnu"
- return render_to_response('connexion/index.html', {'form': form, 'message' : message},context_instance = RequestContext(request))
- else:
- message_error = "Utilisateur non-connu"
- return render_to_response('connexion/index.html', {'form': form, 'message_error' : message_error},context_instance = RequestContext(request))
- else:
- form = AuthenticationForm()
- return render_to_response('connexion/index.html', {'form': form},context_instance = RequestContext(request))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement