Commit 911e3365 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Added non-registered warning to non-registered users.

parent 7c53f6ce
......@@ -8,10 +8,17 @@ from django.core.exceptions import PermissionDenied
from django.contrib.auth.decorators import login_required
from django.shortcuts import render, get_object_or_404, redirect
# Check if user is registered.
def is_registered(user):
return user.groups.filter(name="Registered").exists()
# Homepage view.
@login_required
def index(request):
if not is_registered(request.user):
return render(request, 'not_registered.html')
url_form = URLForm() # unbound form
errors = []
......@@ -59,6 +66,8 @@ def view(request, short):
# My-Links page.
@login_required
def my_links(request):
if not is_registered(request.user):
return render(request, 'not_registered.html')
urls = URL.objects.filter( owner = request.user )
return render(request, 'my_links.html', {
'urls' : urls,
......@@ -68,6 +77,8 @@ def my_links(request):
# Delete link page.
@login_required
def delete(request, short):
if not is_registered(request.user):
return render(request, 'not_registered.html')
url = get_object_or_404(URL, short__iexact = short )
if url.owner == request.user:
url.delete()
......
{% extends 'base.html' %}
{% block title %}
Go - About
{% endblock %}
{% block content %}
<h3>~Account Not Approved~</h3>
<p>
Because Go allows users to represent their group or organization with
George Mason branding, user accounts must be manually approved by a Go
official.
</p>
<p>
This process takes time. Please be patient.
<br/><br/>
</p>
{% endblock %}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment