Commit 7393c7ba authored by Stefano Alberto Russo's avatar Stefano Alberto Russo
Browse files

Improved handling of the invitation code. Minor fixes.

parent 6d5e7554
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -2,8 +2,17 @@ import os
from django.conf import settings
def export_vars(request):
    data = {}
    
    # Set open id connect enabled or not
    if settings.OIDC_RP_CLIENT_ID:
        data['OPENID_ENABLED'] = True
    else:
        data['OPENID_ENABLED'] = False
    
    # Set invitation code required or not
    if settings.INVITATION_CODE:
        data['INVITATION_CODE_ENABLED'] = True
    else:
        data['INVITATION_CODE_ENABLED'] = False   
              
    return data
 No newline at end of file
+10 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@

<div class="container">
  <div class="dashboard">
    <div class="span8 offset2" style="font-size:18px">
    <div class="span8 offset2">
    
      <h1>Register</h1>
      <hr>
@@ -41,7 +41,13 @@

      <p><b>Welcome to Rosetta!</b></p>
      
      <p>We are now in closed beta testing, which means that we can only accept invite-based new users. If you have an invitation code, you can sign up right now. Otherwise, please contact the support ot get one.
      <p>
      {% if INVITATION_CODE_ENABLED %}
      We are now in closed beta testing, which means that we can only accept invite-based new users. If you have an invitation code, you can sign up right now. Otherwise, please contact the support to get one.
      {% else %}
      Enter your email address and choose a password to register on the platform.
      {% endif %}
      </p>
      
      <br/>
      <br/>
@@ -51,7 +57,9 @@
          {% csrf_token %}
          <input type="email" class="form-control" placeholder="Email" name='email' required autofocus>
          <input type="password" class="form-control" placeholder="Password" name='password' required>
          {% if INVITATION_CODE_ENABLED %}
          <input type="text" class="form-control" placeholder="Invitation code" name='invitation' value='' required autofocus>
          {% endif %}
          <input type='submit' class="btn btn-lg ha-btn-lg" value='Go' />
          </form>
      </div>
+3 −2
Original line number Diff line number Diff line
@@ -152,7 +152,8 @@ def register_view(request):
            password = request.POST.get('password')
            invitation = request.POST.get('invitation')
            
            if invitation != os.environ.get('INVITATION_CODE', 'Rosetta'):
            if settings.INVITATION_CODE:
                if invitation != settings.INVITATION_CODE:
                    raise ErrorMessage('Wrong invitation code')

            if '@' not in email:
+3 −0
Original line number Diff line number Diff line
@@ -226,6 +226,9 @@ LOGGING = {
# Local user data dir
LOCAL_USER_DATA_DIR = os.environ.get('LOCAL_USER_DATA_DIR', '/data')

# Invitation code if any
INVITATION_CODE = os.environ.get('INVITATION_CODE', None)


#===============================
#  Auth