Browse Source

[fix] Remove some dead code and deactivate registration by default

ljf 7 years ago
parent
commit
b0e4cb61d1
4 changed files with 16 additions and 33 deletions
  1. 2 5
      coin/members/urls.py
  2. 9 11
      coin/members/views.py
  3. 0 9
      coin/mixins.py
  4. 5 8
      coin/settings_base.py

+ 2 - 5
coin/members/urls.py

@@ -1,18 +1,15 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.conf.urls import patterns, url, include
-from django.views.generic import DetailView
+from django.conf.urls import patterns, url
 from coin.members import forms
 from coin.members import views
-from coin.members.models import Member
 from django.views.generic.base import TemplateView
-from coin.mixins import ExtraContextTemplateView
 from . import registration_views as views_r
 from coin import settings
 
 from registration.signals import user_activated
-from django.contrib.auth import login, authenticate
+from django.contrib.auth import login
 
 def login_on_activation(sender, user, request, **kwargs):
     """Logs in the user after activation"""

+ 9 - 11
coin/members/views.py

@@ -1,11 +1,8 @@
 # -*- coding: utf-8 -*-
 from __future__ import unicode_literals
 
-from django.template import RequestContext, Template
-from django.template.loader import render_to_string
-from django.shortcuts import render_to_response
+from django.shortcuts import render
 from django.contrib.auth.decorators import login_required
-from django.http import Http404
 from django.conf import settings
 
 
@@ -53,10 +50,11 @@ def contact(request):
 
 @login_required
 def activation_completed(request):
-    context=RequestContext(request)
-    label_template = Template(settings.BANK_TRANSFER_LABEL)
-    context['bank_transfer_label'] = label_template.render(context)
-    context['dues'] = settings.MEMBER_DEFAULT_COTISATION
-
-    return render_to_response('members/registration/activation_complete.html',
-                              context_instance=context)
+    label_template = settings.MEMBERSHIP_REFERENCE.format(user=request.user)
+    context = {
+        'bank_transfer_label': label_template,
+        'dues': settings.MEMBER_DEFAULT_COTISATION
+    }
+
+    return render(request, 'members/registration/activation_complete.html',
+                  context)

+ 0 - 9
coin/mixins.py

@@ -6,15 +6,6 @@ from django.conf import settings
 
 from django.views.generic import TemplateView
 
-class ExtraContextTemplateView(TemplateView):
-    """ Allow to create TemplateView with extra context (like settings) """
-
-    extra_context = {}
-    def get_context_data(self, **kwargs):
-         context = super(ExtraContextTemplateView, self).get_context_data(**kwargs)
-         context.update(self.extra_context)
-         return context
-
 
 class CoinLdapSyncMixin(object):
 

+ 5 - 8
coin/settings_base.py

@@ -250,6 +250,10 @@ MEMBER_MEMBERSHIP_INFO_URL = ''
 # Helpful for bank wire transfer identification
 SUBSCRIPTION_REFERENCE = 'REF-{subscription.offer.reference}-{subscription.pk}'
 
+# Template string to display the label the member should indicates for the bank
+# transfer
+MEMBERSHIP_REFERENCE = "ADH-{user.pk}"
+
 # Reset session if cookie older than 2h.
 SESSION_COOKIE_AGE = 7200
 
@@ -263,15 +267,8 @@ FEEDS = (
 
 # Account registration
 # Allow visitor to join the association by register on COIN
-REGISTRATION_OPEN = True
+REGISTRATION_OPEN = False
 
 # All account with unvalidated email will be deleted after X days
 ACCOUNT_ACTIVATION_DAYS = 7
 
-# Additionnal security salt use to build validation link
-REGISTRATION_SALT = "Mouhahahahahaha lol"
-
-# Template string to display the label the member should indicates for the bank
-# transfer
-BANK_TRANSFER_LABEL = "ID{{ user.pk }}"
-