mirror of
https://github.com/django/django.git
synced 2025-06-21 19:39:12 +00:00
multi-auth: Updated comments app to use new auth api.
git-svn-id: http://code.djangoproject.com/svn/django/branches/multi-auth@2889 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
89c6a07a5f
commit
c386867d74
@ -5,7 +5,6 @@ from django.http import Http404
|
|||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.shortcuts import render_to_response
|
from django.shortcuts import render_to_response
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
from django.contrib.auth.models import SESSION_KEY
|
|
||||||
from django.contrib.comments.models import Comment, FreeComment, PHOTOS_REQUIRED, PHOTOS_OPTIONAL, RATINGS_REQUIRED, RATINGS_OPTIONAL, IS_PUBLIC
|
from django.contrib.comments.models import Comment, FreeComment, PHOTOS_REQUIRED, PHOTOS_OPTIONAL, RATINGS_REQUIRED, RATINGS_OPTIONAL, IS_PUBLIC
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
from django.contrib.auth.forms import AuthenticationForm
|
from django.contrib.auth.forms import AuthenticationForm
|
||||||
@ -219,7 +218,8 @@ def post_comment(request):
|
|||||||
# If user gave correct username/password and wasn't already logged in, log them in
|
# If user gave correct username/password and wasn't already logged in, log them in
|
||||||
# so they don't have to enter a username/password again.
|
# so they don't have to enter a username/password again.
|
||||||
if manipulator.get_user() and new_data.has_key('password') and manipulator.get_user().check_password(new_data['password']):
|
if manipulator.get_user() and new_data.has_key('password') and manipulator.get_user().check_password(new_data['password']):
|
||||||
request.session[SESSION_KEY] = manipulator.get_user_id()
|
from django.contrib.auth import login
|
||||||
|
login(request, manipulator.get_user())
|
||||||
if errors or request.POST.has_key('preview'):
|
if errors or request.POST.has_key('preview'):
|
||||||
class CommentFormWrapper(forms.FormWrapper):
|
class CommentFormWrapper(forms.FormWrapper):
|
||||||
def __init__(self, manipulator, new_data, errors, rating_choices):
|
def __init__(self, manipulator, new_data, errors, rating_choices):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user