Merge pull request #244 from clouserw/688402-notifications
Showing messages to users. We can do this now that /login/ is on zamboni; bug 688402
This commit is contained in:
Коммит
e73d7dbf6b
|
@ -686,16 +686,14 @@ class TestRegistration(UserViewBase):
|
|||
self.user_profile.save()
|
||||
|
||||
# URL has the wrong confirmation code
|
||||
# TODO XXX POSTREMORA: Uncomment when remora goes away
|
||||
#url = reverse('users.confirm', args=[self.user.id, 'blah'])
|
||||
#r = self.client.get(url, follow=True)
|
||||
#self.assertContains(r, 'Invalid confirmation code!')
|
||||
url = reverse('users.confirm', args=[self.user.id, 'blah'])
|
||||
r = self.client.get(url, follow=True)
|
||||
self.assertContains(r, 'Invalid confirmation code!')
|
||||
|
||||
# URL has the right confirmation code
|
||||
# TODO XXX POSTREMORA: Uncomment when remora goes away
|
||||
#url = reverse('users.confirm', args=[self.user.id, 'code'])
|
||||
#r = self.client.get(url, follow=True)
|
||||
#self.assertContains(r, 'Successfully verified!')
|
||||
url = reverse('users.confirm', args=[self.user.id, 'code'])
|
||||
r = self.client.get(url, follow=True)
|
||||
self.assertContains(r, 'Successfully verified!')
|
||||
|
||||
def test_confirm_resend(self):
|
||||
# User doesn't have a confirmation code
|
||||
|
@ -708,10 +706,9 @@ class TestRegistration(UserViewBase):
|
|||
self.user_profile.save()
|
||||
|
||||
# URL has the wrong confirmation code
|
||||
# TODO XXX: Bug 593055
|
||||
#url = reverse('users.confirm.resend', args=[self.user.id])
|
||||
#r = self.client.get(url, follow=True)
|
||||
#self.assertContains(r, 'An email has been sent to your address')
|
||||
url = reverse('users.confirm.resend', args=[self.user.id])
|
||||
r = self.client.get(url, follow=True)
|
||||
self.assertContains(r, 'An email has been sent to your address')
|
||||
|
||||
|
||||
class TestProfileLinks(UserViewBase):
|
||||
|
@ -749,23 +746,12 @@ class TestProfileLinks(UserViewBase):
|
|||
GroupUser.objects.create(group=admingroup, user=self.user_profile)
|
||||
cache.clear()
|
||||
|
||||
# Admin, own profile.
|
||||
links = get_links(self.user.id)
|
||||
eq_(links.length, 2)
|
||||
eq_(links.filter('#edit-profile').length, 1)
|
||||
eq_(links.filter('#manage-user').length, 1)
|
||||
|
||||
# TODO XXX Uncomment this when zamboni can delete users. Bug 595035
|
||||
#links = get_links(9945)
|
||||
#eq_(links.length, 1)
|
||||
#eq_(links.eq(0).attr('href'),
|
||||
#reverse('admin:users_userprofile_change', args=[9945]))
|
||||
|
||||
# TODO XXX Uncomment this when zamboni can delete users. Bug 595035
|
||||
# Admin, own profile.
|
||||
#links = get_links(self.user.id)
|
||||
#eq_(links.length, 2)
|
||||
#eq_(links.eq(0).attr('href'), reverse('users.edit'))
|
||||
#eq_(links.eq(1).attr('href'),
|
||||
eq_(links.eq(0).attr('href'), reverse('users.edit'))
|
||||
# TODO XXX Uncomment when we have real user editing pages
|
||||
#eq_(links.eq(1).attr('href') + "/",
|
||||
#reverse('admin:users_userprofile_change', args=[self.user.id]))
|
||||
|
||||
def test_amouser(self):
|
||||
|
|
|
@ -69,22 +69,13 @@ def confirm(request, user_id, token):
|
|||
if user.confirmationcode != token:
|
||||
log.info(u"Account confirmation failed for user (%s)", user)
|
||||
messages.error(request, _('Invalid confirmation code!'))
|
||||
|
||||
amo.utils.clear_messages(request)
|
||||
return http.HttpResponseRedirect(reverse('users.login') + '?m=5')
|
||||
# TODO POSTREMORA Replace the above with this line when
|
||||
# remora goes away
|
||||
#return http.HttpResponseRedirect(reverse('users.login'))
|
||||
return http.HttpResponseRedirect(reverse('users.login'))
|
||||
|
||||
user.confirmationcode = ''
|
||||
user.save()
|
||||
messages.success(request, _('Successfully verified!'))
|
||||
log.info(u"Account confirmed for user (%s)", user)
|
||||
|
||||
amo.utils.clear_messages(request)
|
||||
return http.HttpResponseRedirect(reverse('users.login') + '?m=4')
|
||||
# TODO POSTREMORA Replace the above with this line when remora goes away
|
||||
#return http.HttpResponseRedirect(reverse('users.login'))
|
||||
return http.HttpResponseRedirect(reverse('users.login'))
|
||||
|
||||
|
||||
def confirm_resend(request, user_id):
|
||||
|
@ -502,11 +493,7 @@ def register(request):
|
|||
# case to tne end user so we just log it...
|
||||
log.error("Failed to register new user (%s): %s" % (u, e))
|
||||
|
||||
amo.utils.clear_messages(request)
|
||||
return http.HttpResponseRedirect(reverse('users.login') + '?m=3')
|
||||
# TODO POSTREMORA Replace the above two lines
|
||||
# when remora goes away with this:
|
||||
#return http.HttpResponseRedirect(reverse('users.login'))
|
||||
return http.HttpResponseRedirect(reverse('users.login'))
|
||||
|
||||
else:
|
||||
messages.error(request, _('There are errors in this form'),
|
||||
|
|
|
@ -851,7 +851,7 @@ SESSION_COOKIE_AGE = 1209600
|
|||
SESSION_COOKIE_SECURE = True
|
||||
SESSION_COOKIE_HTTPONLY = True
|
||||
SESSION_COOKIE_DOMAIN = ".%s" % DOMAIN # bug 608797
|
||||
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
|
||||
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
|
||||
|
||||
# These should have app+locale at the start to avoid redirects
|
||||
LOGIN_URL = "/users/login"
|
||||
|
|
Загрузка…
Ссылка в новой задаче