Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Update registration urls names
Anna Siwikb2846c889440
diff --git a/saleor/account/forms.py b/saleor/account/forms.pyindex 7110c8ef56..963e0b8251 100644--- a/saleor/account/forms.py+++ b/saleor/account/forms.py@@ -112,7 +112,7 @@ class PasswordResetForm(django_forms.PasswordResetForm):from_email, to_email, html_email_template_name=None):reset_url = build_absolute_uri(reverse(- 'account_reset_password_confirm',+ 'account:reset-password-confirm',kwargs={'uidb64': context['uid'], 'token': context['token']}))context['reset_url'] = reset_urlsend_templated_mail(diff --git a/saleor/account/urls.py b/saleor/account/urls.pyindex f2e537d7f1..b58779a2c5 100644--- a/saleor/account/urls.py+++ b/saleor/account/urls.py@@ -6,19 +6,19 @@ from . import viewsurlpatterns = [url(r'^$', views.details, name='details'),- url(r'^login/$', views.login, name='account_login'),- url(r'^logout/$', views.logout, name='account_logout'),- url(r'^signup/$', views.signup, name='account_signup'),+ url(r'^login/$', views.login, name='login'),+ url(r'^logout/$', views.logout, name='logout'),+ url(r'^signup/$', views.signup, name='signup'),url(r'^password/reset/$', views.password_reset,- name='account_reset_password'),+ name='reset-password'),url(r'^password/reset/done/$', django_views.PasswordResetDoneView.as_view(template_name='account/password_reset_done.html'),- name='account_reset_password_done'),+ name='reset-password-done'),url(r'^password/reset/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$', # noqa- views.password_reset_confirm, name='account_reset_password_confirm'),+ views.password_reset_confirm, name='reset-password-confirm'),url(r'password/reset/complete/$', django_views.PasswordResetCompleteView.as_view( # noqatemplate_name='account/password_reset_from_key_done.html'),- name='account_reset_password_complete'),+ name='reset-password-complete'),url(r'^address/(?P<pk>\d+)/edit/$', views.address_edit,name='address-edit'),diff --git a/saleor/account/views.py b/saleor/account/views.pyindex b0a23d9e02..1dac365430 100755--- a/saleor/account/views.py+++ b/saleor/account/views.py@@ -50,14 +50,14 @@ def signup(request):def password_reset(request):kwargs = {'template_name': 'account/password_reset.html',- 'success_url': reverse_lazy('account_reset_password_done'),+ 'success_url': reverse_lazy('account:reset-password-done'),'form_class': PasswordResetForm}return django_views.PasswordResetView.as_view(**kwargs)(request, **kwargs)class PasswordResetConfirm(django_views.PasswordResetConfirmView):template_name = 'account/password_reset_from_key.html'- success_url = reverse_lazy('account_reset_password_complete')+ success_url = reverse_lazy('account:reset-password-complete')token = Noneuidb64 = None@@ -65,7 +65,7 @@ class PasswordResetConfirm(django_views.PasswordResetConfirmView):def password_reset_confirm(request, uidb64=None, token=None):kwargs = {'template_name': 'account/password_reset_from_key.html',- 'success_url': reverse_lazy('account_reset_password_complete'),+ 'success_url': reverse_lazy('account:reset-password-complete'),'token': token,'uidb64': uidb64}return PasswordResetConfirm.as_view(**kwargs)(request, **kwargs)diff --git a/saleor/dashboard/views.py b/saleor/dashboard/views.pyindex 3ab7cceb9f..a7b1347529 100644--- a/saleor/dashboard/views.py+++ b/saleor/dashboard/views.py@@ -11,12 +11,12 @@ from ..product.models import Productdef staff_member_required(f):- return _staff_member_required(f, login_url='account_login')+ return _staff_member_required(f, login_url='account:login')def superuser_required(view_func=None, redirect_field_name=REDIRECT_FIELD_NAME,- login_url='account_login'):+ login_url='account:login'):"""Check if the user is logged in and is a superuser.Otherwise redirects to the login page.diff --git a/templates/account/login.html b/templates/account/login.htmlindex f3e5f055dc..47e35477b2 100644--- a/templates/account/login.html+++ b/templates/account/login.html@@ -17,7 +17,7 @@<img class="lazyload lazypreload"data-src="{% static 'images/login-bg.png' %}"data-srcset="{% static 'images/login-bg.png' %} 1x, {% static 'images/login-bg2x.png' %} 2x">- <a rel="nofollow" href="{% url 'account_signup' %}" class="btn secondary narrow">+ <a rel="nofollow" href="{% url 'account:signup' %}" class="btn secondary narrow">{% trans "Register" context "Login form secondary action" %}</a></div>diff --git a/templates/account/partials/login_form.html b/templates/account/partials/login_form.htmlindex c5926a9b2f..6d85c831d6 100644--- a/templates/account/partials/login_form.html+++ b/templates/account/partials/login_form.html@@ -2,7 +2,7 @@{% load i18n %}{% load staticfiles %}-<form method="post" action="{% url 'account_login' %}" novalidate>+<form method="post" action="{% url 'account:login' %}" novalidate>{% csrf_token %}<fieldset>{% bootstrap_form form %}@@ -15,7 +15,7 @@<button class="btn primary narrow">{% trans "Log in" context "Login form primary action" %}</button>- <a rel="nofollow" class="link--styled" href="{% url 'account_reset_password' %}">+ <a rel="nofollow" class="link--styled" href="{% url 'account:reset-password' %}">{% trans "Forgot password?" context "Login form secondary link" %}</a>{% with available_backends=site.settings.available_backends %}diff --git a/templates/account/password_reset_from_key.html b/templates/account/password_reset_from_key.htmlindex a94fe9e9bf..73d84d4aee 100644--- a/templates/account/password_reset_from_key.html+++ b/templates/account/password_reset_from_key.html@@ -9,7 +9,7 @@{% if token_fail %}<div class="col-sm-12"><h2>{% trans "Bad Token" %}</h2>- {% url 'account_reset_password' as passwd_reset_url %}+ {% url 'account:reset-password' as passwd_reset_url %}<p>{% blocktrans trimmed context "Password reset text if key is invalid" %}The password reset link was invalid, possiblybecause it has already been used.<br>@@ -38,7 +38,7 @@{% else %}<h2>{% trans "Password Reset Link Expired" context "Password reset link expired from key form title" %}</h2><p>{% trans "Sorry but this link is no longer valid. If you forget your password, please use link below." context "Password reset from key form title" %}</p>- <a href="{% url 'account_reset_password' %}">+ <a href="{% url 'account:reset-password' %}">{% trans "Reset my password" context "Reset my password link" %}</a>{% endif %}diff --git a/templates/account/password_reset_from_key_done.html b/templates/account/password_reset_from_key_done.htmlindex b002b6fdd6..d01cf71870 100644--- a/templates/account/password_reset_from_key_done.html+++ b/templates/account/password_reset_from_key_done.html@@ -5,7 +5,7 @@{% block form %}<h2>{% trans "Password Changed" context "Password reset from key done title" %}</h2>- {% url "account_login" as login_url %}+ {% url "account:login" as login_url %}<p>{% trans 'Your password is now changed.' %}{% blocktrans trimmed with login_url=login_url context "Password reset from key done text" %}You can now <a href="{{ login_url }}">sign in</a> using your new password{% endblocktrans %}</p>diff --git a/templates/account/signup.html b/templates/account/signup.htmlindex ccb69031d1..96b0b0f64d 100644--- a/templates/account/signup.html+++ b/templates/account/signup.html@@ -17,13 +17,13 @@<h3>{% trans "Already have an account?" context "Signup form secondary title" %}</h3><img class="signup-img lazyload lazypreload" data-src="{% static 'images/login-bg.png' %}"srcset="{% static 'images/login-bg.png' %} 1x, {% static 'images/login-bg2x.png' %} 2x">- <p><a rel="nofollow" href="{% url 'account_login' %}" class="btn secondary narrow">+ <p><a rel="nofollow" href="{% url 'account:login' %}" class="btn secondary narrow">{% trans "Log in" context "Signup form secondary action" %}</a></p></div></div><div class="col-md-6 login__form">- <form method="post" action="{% url 'account_signup' %}">+ <form method="post" action="{% url 'account:signup' %}"><fieldset><h3>{% trans "Create an account" context "Signup form title" %}</h3>{% csrf_token %}diff --git a/templates/base.html b/templates/base.htmlindex 12b3d0c380..5125c10164 100644--- a/templates/base.html+++ b/templates/base.html@@ -67,17 +67,17 @@</li>{% else %}<li>- <a href="{% url "account_logout" %}">+ <a href="{% url "account:logout" %}">{% trans "Log out" context "Main navigation item" %}</a></li>{% endif %}{% else %}<li>- <a rel="nofollow" href="{% url "account_signup" %}">+ <a rel="nofollow" href="{% url "account:signup" %}">{% trans "Register" context "Main navigation item" %}</a></li><li>- <a rel="nofollow" href="{% url "account_login" %}">+ <a rel="nofollow" href="{% url "account:login" %}">{% trans "Log in" context "Main navigation item" %}</a></li>@@ -226,18 +226,18 @@</li>{% else %}<li>- <a href="{% url "account_logout" %}">+ <a href="{% url "account:logout" %}">{% trans "Log out" context "Main navigation item" %}</a></li>{% endif %}{% else %}<li>- <a rel="nofollow" href="{% url "account_signup" %}">+ <a rel="nofollow" href="{% url "account:signup" %}">{% trans "Register" context "Main navigation item" %}</a></li><li>- <a rel="nofollow" href="{% url "account_login" %}">+ <a rel="nofollow" href="{% url "account:login" %}">{% trans "Log in" context "Main navigation item" %}</a></li>diff --git a/templates/dashboard/base.html b/templates/dashboard/base.htmlindex fd599b7d09..5b1155ef40 100644--- a/templates/dashboard/base.html+++ b/templates/dashboard/base.html@@ -47,7 +47,7 @@</a></li><li>- <a href="{% url 'account_logout' %}" class="waves-effect">+ <a href="{% url 'account:logout' %}" class="waves-effect">{% trans "Log out" context "Dashboard top navigation action" %}</a></li>diff --git a/templates/templated_email/source/account/password_reset.email b/templates/templated_email/source/account/password_reset.emailindex 46964ee422..56aad51e0e 100644--- a/templates/templated_email/source/account/password_reset.email+++ b/templates/templated_email/source/account/password_reset.email@@ -12,7 +12,7 @@ You're receiving this e-mail because you or someone else has requested a passworIt can be safely ignored if you did not request a password reset. Click the link below to reset your password.{% endblocktrans %}-{{ protocol}}://{{ domain }}{% url 'account_reset_password_confirm' uidb64=uid token=token %}+{{ protocol}}://{{ domain }}{% url 'account:reset-password-confirm' uidb64=uid token=token %}This is an automatically generated email, please do not reply.diff --git a/templates/templated_email/source/account/password_reset.mjml b/templates/templated_email/source/account/password_reset.mjmlindex 2bbab591ea..a5019a20ae 100644--- a/templates/templated_email/source/account/password_reset.mjml+++ b/templates/templated_email/source/account/password_reset.mjml@@ -24,8 +24,8 @@{% endblocktrans %}</mj-text><mj-text>- <a href="{{ protocol}}://{{ domain }}{% url 'account_reset_password_confirm' uidb64=uid token=token %}">- {{ protocol}}://{{ domain }}{% url 'account_reset_password_confirm' uidb64=uid token=token %}+ <a href="{{ protocol}}://{{ domain }}{% url 'account:reset-password-confirm' uidb64=uid token=token %}">+ {{ protocol}}://{{ domain }}{% url 'account:reset-password-confirm' uidb64=uid token=token %}</a></mj-text></mj-column>diff --git a/templates/templated_email/source/dashboard/staff/set_password.email b/templates/templated_email/source/dashboard/staff/set_password.emailindex 502733d3e0..9ce9a61e28 100644--- a/templates/templated_email/source/dashboard/staff/set_password.email+++ b/templates/templated_email/source/dashboard/staff/set_password.email@@ -9,7 +9,7 @@ You're receiving this e-mail because you have to set password for your staff memClick the link below to reset your password.{% endblocktrans %}-{{ protocol}}://{{ domain }}{% url 'account_reset_password_confirm' uidb64=uid token=token %}+{{ protocol}}://{{ domain }}{% url 'account:reset-password-confirm' uidb64=uid token=token %}{% blocktrans context "Set password for staff member e-mail text" %}This is an automatically generated email, please do not reply.diff --git a/templates/templated_email/source/dashboard/staff/set_password.mjml b/templates/templated_email/source/dashboard/staff/set_password.mjmlindex df5baff858..888fc3eac6 100644--- a/templates/templated_email/source/dashboard/staff/set_password.mjml+++ b/templates/templated_email/source/dashboard/staff/set_password.mjml@@ -24,8 +24,8 @@{% endblocktrans %}</mj-text><mj-text>- <a href="{{ protocol}}://{{ domain }}{% url 'account_reset_password_confirm' uidb64=uid token=token %}">- {{ protocol}}://{{ domain }}{% url 'account_reset_password_confirm' uidb64=uid token=token %}+ <a href="{{ protocol}}://{{ domain }}{% url 'account:reset-password-confirm' uidb64=uid token=token %}">+ {{ protocol}}://{{ domain }}{% url 'account:reset-password-confirm' uidb64=uid token=token %}</a></mj-text></mj-column>diff --git a/tests/dashboard/test_staff.py b/tests/dashboard/test_staff.pyindex 5b2d899910..4d588bda00 100644--- a/tests/dashboard/test_staff.py+++ b/tests/dashboard/test_staff.py@@ -122,13 +122,13 @@ def test_create_staff_and_set_password(admin_client, staff_group):token = default_token_generator.make_token(new_user)response = admin_client.get(reverse(- 'account_reset_password_confirm',+ 'account:reset-password-confirm',kwargs={'uidb64': uid, 'token': token}))assert response.status_code == 302post_data = {'new_password1': 'password', 'new_password2': 'password'}response = admin_client.post(response['Location'], post_data)assert response.status_code == 302- assert response['Location'] == reverse('account_reset_password_complete')+ assert response['Location'] == reverse('account:reset-password-complete')new_user = User.objects.get(email='[email protected]')assert new_user.has_usable_password()diff --git a/tests/test_cart.py b/tests/test_cart.pyindex 0a6da1a908..58037e57a5 100644--- a/tests/test_cart.py+++ b/tests/test_cart.py@@ -229,7 +229,7 @@ def test_find_and_assign_anonymous_cart(client.cookies[utils.COOKIE_NAME] = value# Anonymous logs inresponse = client.post(- reverse('account_login'),+ reverse('account:login'),{'username': customer_user.email, 'password': 'password'}, follow=True)assert response.context['user'] == customer_user# User should have only one cart, the same as he had previously in@@ -243,7 +243,7 @@ def test_find_and_assign_anonymous_cart(def test_login_without_a_cart(customer_user, client):assert utils.COOKIE_NAME not in client.cookiesresponse = client.post(- reverse('account_login'),+ reverse('account:login'),{'username': customer_user.email, 'password': 'password'}, follow=True)assert response.context['user'] == customer_userauthenticated_user_carts = customer_user.carts.filter(@@ -255,7 +255,7 @@ def test_login_with_incorrect_cookie_token(customer_user, client):value = signing.get_cookie_signer(salt=utils.COOKIE_NAME).sign('incorrect')client.cookies[utils.COOKIE_NAME] = valueresponse = client.post(- reverse('account_login'),+ reverse('account:login'),{'username': customer_user.email, 'password': 'password'}, follow=True)assert response.context['user'] == customer_userauthenticated_user_carts = customer_user.carts.filter(diff --git a/tests/test_registration.py b/tests/test_registration.pyindex 669404f293..7f3541fed6 100644--- a/tests/test_registration.py+++ b/tests/test_registration.py@@ -33,7 +33,7 @@ def test_login_form_not_valid(customer_user):def test_login_view_valid(client, customer_user):- url = reverse('account_login')+ url = reverse('account:login')response = client.post(url, {'username': '[email protected]', 'password': 'password'},follow=True)@@ -41,7 +41,7 @@ def test_login_view_valid(client, customer_user):def test_login_view_not_valid(client, customer_user):- url = reverse('account_login')+ url = reverse('account:login')response = client.post(url, {'username': '[email protected]', 'password': 'wrong'},follow=True)@@ -49,7 +49,7 @@ def test_login_view_not_valid(client, customer_user):def test_login_view_next(client, customer_user):- url = reverse('account_login') + '?next=/cart/'+ url = reverse('account:login') + '?next=/cart/'response = client.post(url, {'username': '[email protected]', 'password': 'password'})redirect_location = get_redirect_location(response)@@ -57,7 +57,7 @@ def test_login_view_next(client, customer_user):def test_login_view_redirect(client, customer_user):- url = reverse('account_login')+ url = reverse('account:login')data = {'username': '[email protected]', 'password': 'password','next': '/cart/'}@@ -67,7 +67,7 @@ def test_login_view_redirect(client, customer_user):def test_logout_view_no_user(client):- url = reverse('account_logout')+ url = reverse('account:logout')response = client.get(url)redirect_location = get_redirect_location(response)location = '/account/login/'@@ -75,7 +75,7 @@ def test_logout_view_no_user(client):def test_logout_with_user(authorized_client):- url = reverse('account_logout')+ url = reverse('account:logout')response = authorized_client.get(url, follow=True)assert isinstance(response.context['user'], AnonymousUser)@@ -101,7 +101,7 @@ def test_signup_form_user_exists(customer_user):def test_signup_view_create_user(client, db):- url = reverse('account_signup')+ url = reverse('account:signup')data = {'email': '[email protected]', 'password': 'password'}response = client.post(url, data)assert User.objects.count() == 1@@ -111,7 +111,7 @@ def test_signup_view_create_user(client, db):def test_signup_view_redirect(client, customer_user):- url = reverse('account_signup')+ url = reverse('account:signup')data = {'email': '[email protected]', 'password': 'password','next': '/cart/'}@@ -121,22 +121,22 @@ def test_signup_view_redirect(client, customer_user):def test_signup_view_fail(client, db, customer_user):- url = reverse('account_signup')+ url = reverse('account:signup')data = {'email': customer_user.email, 'password': 'password'}client.post(url, data)assert User.objects.count() == 1def test_password_reset_view_post(client, db):- url = reverse('account_reset_password')+ url = reverse('account:reset-password')data = {'email': '[email protected]'}response = client.post(url, data)redirect_location = get_redirect_location(response)- assert redirect_location == reverse('account_reset_password_done')+ assert redirect_location == reverse('account:reset-password-done')def test_password_reset_view_get(client, db):- url = reverse('account_reset_password')+ url = reverse('account:reset-password')response = client.get(url)assert response.status_code == 200assert response.template_name == ['account/password_reset.html']