diff --git a/apps/reader/forms.py b/apps/reader/forms.py index 7e250440b..dea7ae689 100644 --- a/apps/reader/forms.py +++ b/apps/reader/forms.py @@ -4,6 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from django.contrib.auth.models import User from django.contrib.auth import authenticate from django.db.models import Q +from django.conf import settings from apps.reader.models import Feature from apps.profile.tasks import EmailNewUser from apps.social.models import MActivity @@ -147,6 +148,11 @@ class SignupForm(forms.Form): if new_user.email: EmailNewUser.delay(user_id=new_user.pk) + if getattr(settings, 'AUTO_PREMIUM_NEW_USERS', False): + new_user.profile.activate_premium() + elif getattr(settings, 'AUTO_ENABLE_NEW_USERS', False): + new_user.profile.activate_free() + return new_user class FeatureForm(forms.Form): diff --git a/apps/reader/views.py b/apps/reader/views.py index 921251007..6226db26b 100644 --- a/apps/reader/views.py +++ b/apps/reader/views.py @@ -168,9 +168,10 @@ def signup(request): new_user = form.save() login_user(request, new_user) logging.user(new_user, "~FG~SB~BBNEW SIGNUP~FW") - url = "https://%s%s" % (Site.objects.get_current().domain, - reverse('stripe-form')) - return HttpResponseRedirect(url) + if not new_user.is_active: + url = "https://%s%s" % (Site.objects.get_current().domain, + reverse('stripe-form')) + return HttpResponseRedirect(url) return index(request) diff --git a/local_settings.py.template b/local_settings.py.template index 87c47fd04..36b2cc01c 100644 --- a/local_settings.py.template +++ b/local_settings.py.template @@ -22,6 +22,8 @@ DEBUG = True DEBUG_ASSETS = DEBUG MEDIA_URL = '/media/' SECRET_KEY = 'YOUR SECRET KEY' +AUTO_PREMIUM_NEW_USERS = True +AUTO_ENABLE_NEW_USERS = True # CACHE_BACKEND = 'dummy:///' # CACHE_BACKEND = 'locmem:///' diff --git a/settings.py b/settings.py index 34a153652..f51936935 100644 --- a/settings.py +++ b/settings.py @@ -75,6 +75,8 @@ CIPHER_USERNAMES = False DEBUG_ASSETS = DEBUG HOMEPAGE_USERNAME = 'popular' ALLOWED_HOSTS = ['*'] +AUTO_PREMIUM_NEW_USERS = False +AUTO_ENABLE_NEW_USERS = False # =============== # = Enviornment =