Revert "add /users/pwreset to Marketplace (bug 740256)"
This reverts commit 7829435b0e
.
This commit is contained in:
Родитель
f9267d01e8
Коммит
691f9b1fa3
|
@ -680,8 +680,7 @@ def report_abuse(request, user_id):
|
|||
|
||||
@never_cache
|
||||
@no_login_required
|
||||
def password_reset_confirm(request, uidb36=None, token=None,
|
||||
template='users/pwreset_confirm.html'):
|
||||
def password_reset_confirm(request, uidb36=None, token=None):
|
||||
"""
|
||||
Pulled from django contrib so that we can add user into the form
|
||||
so then we can show relevant messages about the user.
|
||||
|
@ -712,7 +711,7 @@ def password_reset_confirm(request, uidb36=None, token=None,
|
|||
validlink = False
|
||||
form = None
|
||||
|
||||
return jingo.render(request, template,
|
||||
return jingo.render(request, 'users/pwreset_confirm.html',
|
||||
{'form': form, 'validlink': validlink})
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
{% extends 'mkt/base.html' %}
|
||||
|
||||
{% set title = 'Password Reset' %}
|
||||
{% block title %}{{ page_title(title) }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="notification-box success full">
|
||||
<div>
|
||||
<h2>{{ _('Password successfully reset.') }}</h2>
|
||||
</div>
|
||||
</section>
|
||||
{{ mkt_breadcrumbs(product, [(None, title)]) }}
|
||||
<section id="pwreset" class="form-grid">
|
||||
<header class="c">
|
||||
<h1>{{ title }}</h1>
|
||||
</header>
|
||||
<div>
|
||||
<p>You may log in now.</p>
|
||||
<p><a class="button" href="{{ settings.LOGIN_URL }}">{{ _('Log in') }}</a></p>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -1,42 +0,0 @@
|
|||
{% extends 'mkt/base.html' %}
|
||||
|
||||
{% set title = 'Password Reset' %}
|
||||
{% block title %}{{ page_title(title) }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{% if not validlink %}
|
||||
<section class="notification-box error full">
|
||||
<div>
|
||||
<h2>{{ _('Password reset unsuccessful') }}</h2>
|
||||
</div>
|
||||
</section>
|
||||
{% endif %}
|
||||
{{ mkt_breadcrumbs(product, [(None, title)]) }}
|
||||
<section id="pwreset" class="form-grid">
|
||||
<header class="c">
|
||||
<h1>{{ title }}</h1>
|
||||
</header>
|
||||
<div>
|
||||
{% if validlink %}
|
||||
<form class="form-grid" method="post">
|
||||
{{ csrf() }}
|
||||
{% with form_user=form.user %}
|
||||
{% include 'users/tougher_password.html' %}
|
||||
{% endwith %}
|
||||
{{ grid_field(form.new_password1) }}
|
||||
{{ grid_field(form.new_password2) }}
|
||||
<footer class="form-footer">
|
||||
<button type="submit">{{ _('Update') }}</button>
|
||||
</footer>
|
||||
</form>
|
||||
{% else %}
|
||||
<p>
|
||||
{% trans %}
|
||||
The password reset link was invalid, possibly because it has
|
||||
already been used. Please request a new password reset.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -1,28 +0,0 @@
|
|||
{% extends 'mkt/base.html' %}
|
||||
|
||||
{% set title = 'Password Reset' %}
|
||||
{% block title %}{{ page_title(title) }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
{{ mkt_breadcrumbs(product, [(None, title)]) }}
|
||||
<section id="pwreset" class="form-grid">
|
||||
<header class="c">
|
||||
<h1>{{ title }}</h1>
|
||||
</header>
|
||||
<div>
|
||||
<form class="form-grid" method="post">
|
||||
{{ csrf() }}
|
||||
<p>
|
||||
{% trans %}
|
||||
Forgotten your password? Enter your e-mail address below,
|
||||
and we'll e-mail instructions for setting a new one.
|
||||
{% endtrans %}
|
||||
</p>
|
||||
{{ grid_field(form.email, _('Email Address')) }}
|
||||
<footer class="form-footer">
|
||||
<button type="submit">{{ _('Send password reset link') }}</button>
|
||||
</footer>
|
||||
</form>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -1,24 +0,0 @@
|
|||
{% extends 'mkt/base.html' %}
|
||||
|
||||
{% set title = 'Password Reset' %}
|
||||
{% block title %}{{ page_title(title) }}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="notification-box success full">
|
||||
<div>
|
||||
<h2>{{ _('The password reset link was sent to your email address.') }}</h2>
|
||||
</div>
|
||||
</section>
|
||||
{{ mkt_breadcrumbs(product, [(None, title)]) }}
|
||||
<section id="pwreset" class="form-grid">
|
||||
<header class="c">
|
||||
<h1>{{ title }}</h1>
|
||||
</header>
|
||||
<div>
|
||||
<p>
|
||||
Once you check your email and confirm your password you'll be able to
|
||||
log in.
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -1,10 +1,8 @@
|
|||
from datetime import datetime, timedelta
|
||||
|
||||
from django.contrib.auth.tokens import default_token_generator
|
||||
from django.core import mail
|
||||
from django.core.cache import cache
|
||||
from django.forms.models import model_to_dict
|
||||
from django.utils.http import int_to_base36
|
||||
|
||||
import mock
|
||||
from jingo.helpers import datetime as datetime_filter
|
||||
|
@ -695,34 +693,3 @@ class TestPurchases(PurchaseBase):
|
|||
"Expected '.item' to have 'reversed' class")
|
||||
assert not item.find('a.request-support'), (
|
||||
"Unexpected 'Request Support' link")
|
||||
|
||||
|
||||
class TestPasswordReset(amo.tests.TestCase):
|
||||
fixtures = ['base/users']
|
||||
|
||||
def setUp(self):
|
||||
self.user = self.get_user()
|
||||
self.token = [int_to_base36(self.user.id),
|
||||
default_token_generator.make_token(self.user)]
|
||||
self.url = reverse('users.pwreset_confirm', args=self.token)
|
||||
|
||||
def get_user(self):
|
||||
return UserProfile.objects.get(email='editor@mozilla.com')
|
||||
|
||||
def test_reset_msg(self):
|
||||
res = self.client.get(self.url)
|
||||
assert 'For your account' in res.content
|
||||
|
||||
def test_reset_fails(self):
|
||||
res = self.client.post(self.url, {'new_password1': 'spassword',
|
||||
'new_password2': 'spassword'})
|
||||
eq_(res.context['form'].errors['new_password1'][0],
|
||||
'Letters and numbers required.')
|
||||
|
||||
|
||||
class TestLegacyRedirects(amo.tests.TestCase):
|
||||
fixtures = ['base/users']
|
||||
|
||||
def test_disable_register(self):
|
||||
r = self.client.get(reverse('users.register'))
|
||||
self.assertRedirects(r, reverse('users.login'), 301)
|
||||
|
|
|
@ -1,20 +1,11 @@
|
|||
from django.conf.urls.defaults import include, patterns, url
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.shortcuts import redirect
|
||||
|
||||
from session_csrf import anonymous_csrf
|
||||
from lib.misc.urlconf_decorator import decorate
|
||||
|
||||
from amo.decorators import login_required
|
||||
from users.forms import PasswordResetForm
|
||||
from users.models import UserProfile
|
||||
from . import views
|
||||
|
||||
|
||||
# We need Django to use our User model.
|
||||
auth_views.User = UserProfile
|
||||
|
||||
|
||||
settings_patterns = patterns('',
|
||||
url('delete$', views.delete, name='account.delete'),
|
||||
url('delete_photo$', views.delete_photo,
|
||||
|
@ -41,21 +32,6 @@ purchases_patterns = decorate(login_required, patterns('',
|
|||
))
|
||||
|
||||
users_patterns = patterns('',
|
||||
url(r'^register$', lambda r: redirect('users.login', permanent=True)),
|
||||
|
||||
url(r'^pwreset/?$', anonymous_csrf(auth_views.password_reset),
|
||||
{'template_name': 'account/pwreset/request.html',
|
||||
'email_template_name': 'users/email/pwreset.ltxt',
|
||||
'password_reset_form': PasswordResetForm}, name='users.pwreset'),
|
||||
url(r'^pwreset/(?P<uidb36>\w{1,13})/(?P<token>\w{1,13}-\w{1,20})$',
|
||||
views.password_reset_confirm, name='users.pwreset_confirm'),
|
||||
url(r'^pwresetsent$', auth_views.password_reset_done,
|
||||
{'template_name': 'account/pwreset/sent.html'},
|
||||
name='users.pwreset_sent'),
|
||||
url(r'^pwresetcomplete$', auth_views.password_reset_complete,
|
||||
{'template_name': 'account/pwreset/complete.html'},
|
||||
name='users.pwreset_complete'),
|
||||
|
||||
# Keeping the same URL pattern since admin pages already know about this.
|
||||
url(r'^(?:(?P<user_id>\d+)/)?edit$', views.admin_edit,
|
||||
name='users.admin_edit'),
|
||||
|
|
|
@ -22,9 +22,7 @@ from stats.models import Contribution
|
|||
from translations.query import order_by_translation
|
||||
from users.models import UserProfile
|
||||
from users.tasks import delete_photo as delete_photo_task
|
||||
from users.views import (logout,
|
||||
password_reset_confirm as amo_password_reset_confirm)
|
||||
|
||||
from users.views import logout
|
||||
from mkt.account.forms import CurrencyForm
|
||||
from mkt.site import messages
|
||||
from mkt.webapps.models import Webapp
|
||||
|
@ -272,8 +270,3 @@ def profile(request, username):
|
|||
'submissions': submissions, 'own_profile': own_profile}
|
||||
|
||||
return jingo.render(request, 'account/profile.html', data)
|
||||
|
||||
|
||||
def password_reset_confirm(request, uidb36=None, token=None):
|
||||
return amo_password_reset_confirm(request, uidb36, token,
|
||||
'account/pwreset/confirm.html')
|
||||
|
|
|
@ -56,15 +56,15 @@ urlpatterns = patterns('',
|
|||
# Support (e.g., refunds, FAQs).
|
||||
('^support/', include('mkt.support.urls')),
|
||||
|
||||
# Users (Legacy).
|
||||
('^user/(?P<user_id>\d+)/', include(user_detail_patterns)),
|
||||
('^users/', include(users_users_patterns)),
|
||||
|
||||
# Account info (e.g., purchases, settings).
|
||||
('^users/', include(mkt_users_patterns)),
|
||||
('^purchases/', include(purchases_patterns)),
|
||||
('^settings', include(settings_patterns)),
|
||||
|
||||
# Users (Legacy).
|
||||
('^user/(?P<user_id>\d+)/', include(user_detail_patterns)),
|
||||
('^users/', include(users_users_patterns)),
|
||||
|
||||
# Site Search.
|
||||
('^search/', include('mkt.search.urls')),
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче