magic-removal: Removed django/views/core, which was empty
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1659 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8f696be3b7
commit
bdb1776a8f
|
@ -1,8 +1,8 @@
|
||||||
from django.parts.auth.formfields import AuthenticationForm
|
from django.parts.auth.formfields import AuthenticationForm
|
||||||
from django.core import formfields
|
from django.core import formfields
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import DjangoContext, render_to_response
|
||||||
from django.models.auth import users
|
from django.models.auth import SESSION_KEY
|
||||||
from django.models.core import sites
|
from django.models.core import Site
|
||||||
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
|
from django.utils.httpwrappers import HttpResponse, HttpResponseRedirect
|
||||||
|
|
||||||
REDIRECT_FIELD_NAME = 'next'
|
REDIRECT_FIELD_NAME = 'next'
|
||||||
|
@ -18,7 +18,7 @@ def login(request):
|
||||||
# Light security check -- make sure redirect_to isn't garbage.
|
# Light security check -- make sure redirect_to isn't garbage.
|
||||||
if not redirect_to or '://' in redirect_to or ' ' in redirect_to:
|
if not redirect_to or '://' in redirect_to or ' ' in redirect_to:
|
||||||
redirect_to = '/accounts/profile/'
|
redirect_to = '/accounts/profile/'
|
||||||
request.session[users.SESSION_KEY] = manipulator.get_user_id()
|
request.session[SESSION_KEY] = manipulator.get_user_id()
|
||||||
request.session.delete_test_cookie()
|
request.session.delete_test_cookie()
|
||||||
return HttpResponseRedirect(redirect_to)
|
return HttpResponseRedirect(redirect_to)
|
||||||
else:
|
else:
|
||||||
|
@ -27,13 +27,13 @@ def login(request):
|
||||||
return render_to_response('registration/login', {
|
return render_to_response('registration/login', {
|
||||||
'form': formfields.FormWrapper(manipulator, request.POST, errors),
|
'form': formfields.FormWrapper(manipulator, request.POST, errors),
|
||||||
REDIRECT_FIELD_NAME: redirect_to,
|
REDIRECT_FIELD_NAME: redirect_to,
|
||||||
'site_name': sites.get_current().name,
|
'site_name': Site.objects.get_current().name,
|
||||||
}, context_instance=DjangoContext(request))
|
}, context_instance=DjangoContext(request))
|
||||||
|
|
||||||
def logout(request, next_page=None):
|
def logout(request, next_page=None):
|
||||||
"Logs out the user and displays 'You are logged out' message."
|
"Logs out the user and displays 'You are logged out' message."
|
||||||
try:
|
try:
|
||||||
del request.session[users.SESSION_KEY]
|
del request.session[SESSION_KEY]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return render_to_response('registration/logged_out', context_instance=DjangoContext(request))
|
return render_to_response('registration/logged_out', context_instance=DjangoContext(request))
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django.core import formfields, validators
|
from django.core import formfields, validators
|
||||||
from django.core.extensions import DjangoContext, render_to_response
|
from django.core.extensions import DjangoContext, render_to_response
|
||||||
from django.core.template import Context, loader
|
from django.core.template import Context, loader
|
||||||
from django.models.auth import users
|
from django.models.auth import User
|
||||||
from django.views.decorators.auth import login_required
|
from django.views.decorators.auth import login_required
|
||||||
from django.utils.httpwrappers import HttpResponseRedirect
|
from django.utils.httpwrappers import HttpResponseRedirect
|
||||||
|
|
||||||
|
@ -16,15 +16,15 @@ class PasswordResetForm(formfields.Manipulator):
|
||||||
def isValidUserEmail(self, new_data, all_data):
|
def isValidUserEmail(self, new_data, all_data):
|
||||||
"Validates that a user exists with the given e-mail address"
|
"Validates that a user exists with the given e-mail address"
|
||||||
try:
|
try:
|
||||||
self.user_cache = users.get_object(email__iexact=new_data)
|
self.user_cache = User.objects.get_object(email__iexact=new_data)
|
||||||
except users.UserDoesNotExist:
|
except User.DoesNotExist:
|
||||||
raise validators.ValidationError, "That e-mail address doesn't have an associated user acount. Are you sure you've registered?"
|
raise validators.ValidationError, "That e-mail address doesn't have an associated user acount. Are you sure you've registered?"
|
||||||
|
|
||||||
def save(self, domain_override=None):
|
def save(self, domain_override=None):
|
||||||
"Calculates a new password randomly and sends it to the user"
|
"Calculates a new password randomly and sends it to the user"
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
from django.models.core import sites
|
from django.models.core import sites
|
||||||
new_pass = users.make_random_password()
|
new_pass = User.objects.make_random_password()
|
||||||
self.user_cache.set_password(new_pass)
|
self.user_cache.set_password(new_pass)
|
||||||
self.user_cache.save()
|
self.user_cache.save()
|
||||||
if not domain_override:
|
if not domain_override:
|
||||||
|
|
Loading…
Reference in New Issue