Commit aefab0ba authored by Birin Sanchez's avatar Birin Sanchez
Browse files

* Change Basic/Monthly users pending registration message.


* After Basic/Monthly registration redirect to profile page.
* Remove deprecated cart/n/ URL.
Signed-off-by: Birin Sanchez's avatarBirin Sanchez <birin.sanchez@puri.sm>
parent f1e75d84
Pipeline #33737 passed with stage
in 31 seconds
from django.conf import settings
from django.contrib.auth import logout
from django.urls import reverse
from registration.backends.simple.views import RegistrationView
from cart.models import ChosenReward
from purist.models import AccountType
from .forms import CartRegistrationFormWithCaptcha, CartRegistrationForm
from limitmonitor.common import forced_update
from limitmonitor.task_resources.subscription import create_user_subscription
import json
......@@ -48,11 +50,7 @@ class CartRegistrationView(RegistrationView):
if self.bundle == 'Basic':
url = '{}/{}/{}&reauth=1'.format(
settings.WOO_URL,
'wp-login.php?redirect_to=',
settings.WOO_CART_THANKS_PATH,
)
url = reverse('profile')
else:
# go to WooCommerce cart URL
......@@ -78,6 +76,7 @@ class CartRegistrationView(RegistrationView):
if self.bundle == 'Basic':
user.account_type = AccountType.BASIC
create_user_subscription(user, paid=True, billing_email=user.email)
forced_update(user)
elif self.bundle == 'Complete':
user.account_type = AccountType.COMPLETE
......
......@@ -29,14 +29,18 @@ SPDX-License-Identifier: AGPL-3.0
{% if haschosenreward and request.user.chosenreward.is_pending %}
<div class="notice">
<p>
{% if request.user.account_type.is_basic %}
Your registration is pending, please wait two minutes before refreshing this page.
{% else %}
Your registration is pending. If you completed the billing process, please wait two minutes before refreshing this page.
</p>
{% if not haspaid %}
<p>If you have <strong><i>not</i></strong> completed the billing process, <a href="{{complete_signup_url}}">please do so now.</a>
</p>
<p>
Pending registrations are removed after 24 hours.
</p>
{% if not haspaid %}
<p>If you have <strong><i>not</i></strong> completed the billing process, <a href="{{complete_signup_url}}">please do so now.</a>
</p>
<p>
Pending registrations are removed after 24 hours.
</p>
{% endif %}
{% endif %}
</div>
{% else %}
......
......@@ -77,7 +77,6 @@ urlpatterns = [
url(r'^download/', include('django_agpl.urls')),
url(r'^jslicense/$', purist.views.jslicense, name='jslicense'),
url(r'^captcha/', include('captcha.urls')),
url(r'^cart/(?P<reward>\d+)/$', CartRegistrationView.as_view(), name="register_reward"),
url(r'^invitation/(?P<msg_hash>.+)/$',
InvitationRegistrationView.as_view(),
name="register_invitation"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment