mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-31 21:41:33 +00:00
Adding auto-enable free users setting for local installs.
This commit is contained in:
parent
5329f52f9f
commit
96f1de7b58
4 changed files with 14 additions and 3 deletions
|
@ -4,6 +4,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.contrib.auth import authenticate
|
from django.contrib.auth import authenticate
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
from django.conf import settings
|
||||||
from apps.reader.models import Feature
|
from apps.reader.models import Feature
|
||||||
from apps.profile.tasks import EmailNewUser
|
from apps.profile.tasks import EmailNewUser
|
||||||
from apps.social.models import MActivity
|
from apps.social.models import MActivity
|
||||||
|
@ -147,6 +148,11 @@ class SignupForm(forms.Form):
|
||||||
if new_user.email:
|
if new_user.email:
|
||||||
EmailNewUser.delay(user_id=new_user.pk)
|
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
|
return new_user
|
||||||
|
|
||||||
class FeatureForm(forms.Form):
|
class FeatureForm(forms.Form):
|
||||||
|
|
|
@ -168,9 +168,10 @@ def signup(request):
|
||||||
new_user = form.save()
|
new_user = form.save()
|
||||||
login_user(request, new_user)
|
login_user(request, new_user)
|
||||||
logging.user(new_user, "~FG~SB~BBNEW SIGNUP~FW")
|
logging.user(new_user, "~FG~SB~BBNEW SIGNUP~FW")
|
||||||
url = "https://%s%s" % (Site.objects.get_current().domain,
|
if not new_user.is_active:
|
||||||
reverse('stripe-form'))
|
url = "https://%s%s" % (Site.objects.get_current().domain,
|
||||||
return HttpResponseRedirect(url)
|
reverse('stripe-form'))
|
||||||
|
return HttpResponseRedirect(url)
|
||||||
|
|
||||||
return index(request)
|
return index(request)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@ DEBUG = True
|
||||||
DEBUG_ASSETS = DEBUG
|
DEBUG_ASSETS = DEBUG
|
||||||
MEDIA_URL = '/media/'
|
MEDIA_URL = '/media/'
|
||||||
SECRET_KEY = 'YOUR SECRET KEY'
|
SECRET_KEY = 'YOUR SECRET KEY'
|
||||||
|
AUTO_PREMIUM_NEW_USERS = True
|
||||||
|
AUTO_ENABLE_NEW_USERS = True
|
||||||
|
|
||||||
# CACHE_BACKEND = 'dummy:///'
|
# CACHE_BACKEND = 'dummy:///'
|
||||||
# CACHE_BACKEND = 'locmem:///'
|
# CACHE_BACKEND = 'locmem:///'
|
||||||
|
|
|
@ -75,6 +75,8 @@ CIPHER_USERNAMES = False
|
||||||
DEBUG_ASSETS = DEBUG
|
DEBUG_ASSETS = DEBUG
|
||||||
HOMEPAGE_USERNAME = 'popular'
|
HOMEPAGE_USERNAME = 'popular'
|
||||||
ALLOWED_HOSTS = ['*']
|
ALLOWED_HOSTS = ['*']
|
||||||
|
AUTO_PREMIUM_NEW_USERS = False
|
||||||
|
AUTO_ENABLE_NEW_USERS = False
|
||||||
|
|
||||||
# ===============
|
# ===============
|
||||||
# = Enviornment =
|
# = Enviornment =
|
||||||
|
|
Loading…
Add table
Reference in a new issue