From 8037e7c3cf9974d61cf609607de3acee7f2296bb Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Wed, 30 Mar 2016 07:13:10 +0200
Subject: [PATCH] Trying to get invitations to work properly

---
 scipost/forms.py                              | 2 +-
 scipost/templates/scipost/personal_page.html  | 5 +++--
 scipost/templates/scipost/register.html       | 2 +-
 scipost/urls.py                               | 1 +
 scipost/views.py                              | 5 -----
 submissions/templates/submissions/browse.html | 2 ++
 6 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/scipost/forms.py b/scipost/forms.py
index 388ab3878..d81af58a7 100644
--- a/scipost/forms.py
+++ b/scipost/forms.py
@@ -35,7 +35,7 @@ class RegistrationForm(forms.Form):
     password = forms.CharField(label='* Password', widget=forms.PasswordInput())
     password_verif = forms.CharField(label='* Verify pwd', widget=forms.PasswordInput())
     captcha = CaptchaField(label='* I am not a robot')
-    invited = forms.BooleanField(widget=forms.HiddenInput())
+#    invited = forms.BooleanField(widget=forms.HiddenInput(), required=False)
 
 class RegistrationInvitationForm(forms.ModelForm):
     class Meta:
diff --git a/scipost/templates/scipost/personal_page.html b/scipost/templates/scipost/personal_page.html
index a36bc2b4f..281f4d19d 100644
--- a/scipost/templates/scipost/personal_page.html
+++ b/scipost/templates/scipost/personal_page.html
@@ -79,7 +79,7 @@
   </div>
 </section>
 
-{% if request.user|is_in_group:'Vetting Editors' %}
+{% if request.user|is_in_group:'SciPost Administrators' or request.user|is_in_group:'Editorial College' or request.user|is_in_group:'Vetting Editors' %}
 <section>
   <hr class="hr12">
   <div class="flex-greybox">
@@ -108,7 +108,8 @@
       <li><a href="{% url 'scipost:vet_authorship_claims' %}">Vet Authorship Claims</a> ({{ nr_authorship_claims_to_vet }})</li>
     </ul>
   </div>
-  {% if request.user|is_in_group:'Editorial College' %}
+
+  {% if request.user|is_in_group:'SciPost Administrators' or request.user|is_in_group:'Editorial College' %}
   <div class="col-4">
     <h3>Submissions processing</h3>
     <ul>
diff --git a/scipost/templates/scipost/register.html b/scipost/templates/scipost/register.html
index abb4b07cb..9981e3505 100644
--- a/scipost/templates/scipost/register.html
+++ b/scipost/templates/scipost/register.html
@@ -7,7 +7,7 @@
 <section>
   <h1>Register to SciPost</h1>
 
-  {% if form.invited %}<!-- Temporary: only see form if invited (thus welcome_message exists) -->
+  {% if request.session.invited == True %}<!-- Temporary: only see form if invited -->
 
   <div class="flex-greybox">
     <h2>{{ welcome_message }}</h2>
diff --git a/scipost/urls.py b/scipost/urls.py
index dd0f417e6..d164a044d 100644
--- a/scipost/urls.py
+++ b/scipost/urls.py
@@ -31,6 +31,7 @@ urlpatterns = [
     url(r'^vet_registration_request_ack/(?P<contributor_id>[0-9]+)$', views.vet_registration_request_ack, name='vet_registration_request_ack'),
     url(r'^registration_invitations$', views.registration_invitations, name="registration_invitations"),
     url(r'^registration_invitation_sent$', TemplateView.as_view(template_name='scipost/registration_invitation_sent.html'), name='registration_invitation_sent'),
+    #url(r'^invitation/(?P<key>.+)$', views.accept_invitation, name='accept_invitation'),
     url(r'^invitation/(?P<key>.+)$', views.accept_invitation, name='accept_invitation'),
     url(r'^accept_invitation_error$', TemplateView.as_view(template_name='scipost/accept_invitation_error.html'), name='accept_invitation_error'),
 
diff --git a/scipost/views.py b/scipost/views.py
index 505ceebd6..890f34765 100644
--- a/scipost/views.py
+++ b/scipost/views.py
@@ -88,9 +88,6 @@ def register(request):
         form = RegistrationForm(request.POST)
         Utils.load({'form': form})
         if form.is_valid():
-            if form['invited'] == False:
-                return render(request, 'scipost/register.html',
-                              {'form': form, 'errormessage': 'Registration is by invitation only at this stage. Come back after 1 May!'})
             if Utils.password_mismatch():
                 return render(request, 'scipost/register.html', 
                               {'form': form, 'errormessage': 'Your passwords must match'})
@@ -105,7 +102,6 @@ def register(request):
             return HttpResponseRedirect('thanks_for_registering')
     else:
         form = RegistrationForm()
-        form['invited'] = False
     context = {'form': form}
     return render(request, 'scipost/register.html', context)
 
@@ -249,7 +245,6 @@ def accept_invitation(request, key):
         form.fields['last_name'].initial = invitation.last_name
         form.fields['first_name'].initial = invitation.first_name
         form.fields['email'].initial = invitation.email_address
-        form.fields['invited'].initial = True
         errormessage = ''
         welcome_message = 'Welcome, ' + title_dict[invitation.title] + ' ' + invitation.last_name + ', and thanks in advance for registering (by completing this form)'
         return render(request, 'scipost/register.html', {'form': form, 'errormessage': errormessage, 'welcome_message': welcome_message})
diff --git a/submissions/templates/submissions/browse.html b/submissions/templates/submissions/browse.html
index 3f8d4bf23..f2d0f75ac 100644
--- a/submissions/templates/submissions/browse.html
+++ b/submissions/templates/submissions/browse.html
@@ -17,6 +17,8 @@
   <div class="flex-container">
     <div class="flex-greybox320">
       <h1>SciPost Submissions</h1>
+      <h3><a href="{% url 'scipost:peer_witnessed_refereeing' %}">About peer-witnessed refereeing</a></h3>
+      <h3><a href="{% url 'submissions:sub_and_ref_procedure' %}">Submission and refereeing procedure</a></h3>
       <h3><a href="{% url 'submissions:submit_manuscript' %}">Submit a manuscript to SciPost</a></h3>
     </div>
     <div class="flex-greybox320">
-- 
GitLab