Commit 7933bb5f authored by Eyad Hasan's avatar Eyad Hasan

39 commits behind

parents fda41933 0f5f9af4
Pipeline #1302 passed with stage
in 1 minute and 39 seconds
......@@ -56,5 +56,6 @@ Go-py3.6:
image: library/python:3.6
type: test
script:
- if pip list --outdated | grep "Latest" | wc -l > 0; then pip list --outdated && exit 1; else exit 0; fi
- coverage run --source=go --omit=*migrations/*,*admin.py,*manage.py,*wsgi.py,*settings.py,*secret.py,*__init__.py,*.pyc,*templates/*,*static/* manage.py test
- coverage html -i && grep pc_cov htmlcov/index.html | egrep -o "[0-9]+\%" | awk '{ print "covered " $1;}'
# On Contributing
## git
First take a look at [github flow](https://guides.github.com/introduction/flow/)
as this page gives a good starting point on understanding how to work with `git`
in an open source repo.
......@@ -77,7 +78,13 @@ Example commit description:
### Merging to the current development branch
Once you've finished work in a branch open a [pull request](https://git.gmu.edu/srct/go/merge_requests/new)
Once you've finished work in a branch you will need to push your commits to gitlab.
git push origin ##-branchname
`Origin` is gitlab.
Open a [merge request](https://git.gmu.edu/srct/go/merge_requests/new)
to start the process of getting your code into the repo. Your code wil be reviewed
by another member before being merged. Your code must pass our tests and include
in the description:
......
......@@ -12,7 +12,7 @@ from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
# App Imports
from go.models import URL, RegisteredUser
from .models import URL, RegisteredUser
class URLAdmin(admin.ModelAdmin):
"""
......
......@@ -19,7 +19,7 @@ from django.utils import timezone
from django.utils.safestring import mark_safe
# App Imports
from go.models import URL, RegisteredUser
from .models import URL, RegisteredUser
# Other Imports
from bootstrap3_datetime.widgets import DateTimePicker
......
......@@ -134,14 +134,13 @@ class URL(models.Model):
"""
if cache.get("hashids_counter") is None:
cache.set("hashids_counter", URL.objects.count())
cache.incr("hashids_counter")
short = HASHIDS.encrypt(cache.get("hashids_counter"))
tries = 1
while tries < 100:
try:
URL.objects.get(short__iexact=short)
short = HASHIDS.encrypt(cache.get("hashids_counter"))
tries += 1
cache.incr("hashids_counter")
URL.objects.get(short__iexact=short)
except URL.DoesNotExist as ex:
print(ex)
return short
......
......@@ -7,17 +7,20 @@
<!-- define the content block for the page -->
{% block content %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-balance-scale fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Moderation Panel</i>
</strong></h1>
Moderation Panel
</h1>
</div>
</div>
</div>
......@@ -309,8 +312,7 @@
</form>
</div>
</div>
<script src="../../static/js/useradmin.js">
</script>
<script src="{% static "js/useradmin.js" %}"></script>
{% endblock %}
\ No newline at end of file
......@@ -10,13 +10,13 @@ SRCT Go &bull; Account Blocked
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-ban fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Account Is Blocked</i>
</strong></h1>
Account Is Blocked
</h1>
</div>
</div>
</div>
......@@ -32,10 +32,11 @@ SRCT Go &bull; Account Blocked
<p>
If you believe this is an error, please contact the <a href="mailto:srct@gmu.edu">Go Admins</a>
<br />
<br/>
<br />
Thank you, and have a nice day!
</p>
<br/><br/>
<br />
<br />
</div>
</div>
{% endblock %}
......@@ -13,13 +13,13 @@ SRCT Go &bull; About
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-question fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">About</i>
</strong></h1>
About
</h1>
</div>
</div>
</div>
......@@ -27,12 +27,12 @@ SRCT Go &bull; About
<!-- define the terms of use div -->
<div class="row" id="terms">
<div class="col-md-12">
<h4><i class="fa">Terms of Use</i></h4>
<h4>Terms of Use</h4>
<legend></legend>
<p>
By using Go you acknowledge that you are a current George Mason Student or faculty member.
<br></br>
Additionally any link that you create is subject to removal by Go admins if it is deemed
Additionally, any link that you create is subject to removal by Go admins if it is deemed
to associate the univeristy with any
<br />
derogatory or controversial matters.
......@@ -53,7 +53,7 @@ SRCT Go &bull; About
<!-- define the who made go? div -->
<div class="row">
<div class="col-md-12">
<h4><i class="fa">Who made Go?</i></h4>
<h4>Who made Go?</h4>
<legend></legend>
<p>
Members of the
......@@ -77,7 +77,7 @@ SRCT Go &bull; About
<!-- define the thanks! div -->
<div class="row">
<div class="col-md-12">
<h4><i class="fa">Thanks</i></h4>
<h4>Thanks</h4>
<legend></legend>
<p>
This project was made possible through the collective contributions of multiple Mason SRCT members.
......@@ -103,7 +103,7 @@ SRCT Go &bull; About
<br></br>
Go 1.0:
<br />
<a href="https://github.com/jrouly">Michel Rouley</a>,
<a href="https://github.com/jrouly">Michel Rouly</a>,
<a href="https://github.com/creffett">Chris Reffett</a>,
<a href="https://github.com/nanderson94">Nicholas Anderson</a>,
and <a href="https://github.com/akshaykarthik">Akshay Karthik</a>.
......
......@@ -19,13 +19,13 @@ SRCT Go &bull; Edit Link
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-wrench fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Edit Link</i>
</strong></h1>
Edit Link
</h1>
</div>
</div>
</div>
......
......@@ -13,13 +13,13 @@ SRCT Go &bull; My Links
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-link fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">My Links</i>
</strong></h1>
My Links
</h1>
</div>
</div>
<div class="newlink" style="text-align: right;">
......
......@@ -19,13 +19,13 @@ SRCT Go &bull; New Link
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-link fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Shorten URL</i>
</strong></h1>
Shorten URL
</h1>
</div>
</div>
</div>
......
......@@ -16,13 +16,13 @@ SRCT Go &bull; Apply
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-user-plus fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Apply to Go</i>
</strong></h1>
Apply to Go
</h1>
</div>
</div>
</div>
......
......@@ -6,55 +6,66 @@
<!-- Start the HTML page for Go -->
<html>
<!-- load in our header content for every page -->
<head>
<!-- load in the title block defined on each html page -->
<title>
{% block title %}
{% endblock %}
</title>
<!-- load in our header content for every page -->
<head>
<!-- load in the title block defined on each html page -->
<title>
{% block title %}
{% endblock %}
</title>
<!-- Some metadata -->
<meta charset="UTF-8">
<meta name="keywords" content="George Mason, URL shortener, URL">
<meta name="description" content="University branded URL shortener.">
<meta name="author" content="Mason SRCT">
<meta name="robots" content="all">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#006633">
<!-- Load in our icon -->
<link rel="icon" type="image/ico" href="{% static "img/favicon.ico"%}" />
<!-- Load in global CSS -->
<link href="https://fonts.googleapis.com/css?family=Carrois+Gothic"
rel="stylesheet" type="text/css">
<link
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet">
<link rel="stylesheet" href="{% static "css/bootswatch.min.css" %}" />
<link rel="stylesheet" href="{% static "css/styles.css" %}" />
<!-- Load in global js -->
<script src="{% static "js/jquery.min.js" %}"></script>
<script src="{% static "js/bootstrap.min.js" %}"></script>
<script src="{% static "js/clipboard.min.js" %}"></script>
</head>
<!-- Load in the body of a Go page -->
<body>
<!-- Load in the navbar template -->
{% include 'layouts/navigation.html' %}
<!-- Wrap the page content in a container -->
<div class="container">
<!-- Load in the main page content -->
{% block content %}
{% endblock %}
</div>
<!-- Load in the footer template -->
{% include 'layouts/footer.html' %}
</body>
</html>
<!-- Metatags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<!-- Chrome on Android navbar color -->
<meta name="theme-color" content="#006633">
<!-- FB/Opengraph tags -->
<meta property="og:url" content="https://go.gmu.edu/">
<meta property="og:type" content="website">
<meta property="og:title" content="SRCT Go">
<!--<meta property="og:image" content="https://git.gmu.edu/uploads/project/avatar/10/noun_534670_cc.png">-->
<meta property="og:description" content="University-branded URL shortening.">
<meta property="og:site_name" content="SRCT Go">
<meta property="og:locale" content="en_US">
<meta property="article:author" content="SRCT">
<!-- Twitter card tags -->
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@MasonSRCT">
<meta name="twitter:creator" content="@MasonSRCT">
<meta name="twitter:url" content="https://go.gmu.edu/">
<meta name="twitter:title" content="SRCT Gp">
<meta name="twitter:description" content="University-branded URL shortening.">
<!--<meta name="twitter:image" content="https://git.gmu.edu/uploads/project/avatar/10/noun_534670_cc.png">-->
<!-- Load in our icon -->
<link rel="icon" type="image/ico" href="{% static "img/favicon.ico" %}" />
<!-- Load in global CSS -->
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
rel="stylesheet" type="text/css">
<link rel="stylesheet" href="{% static "css/bootswatch.min.css" %}" />
<link rel="stylesheet" href="{% static "css/styles.css" %}" />
<!-- Load in global JS -->
<script src="{% static "js/jquery.min.js" %}"></script>
<script src="{% static "js/bootstrap.min.js" %}"></script>
<script src="{% static "js/clipboard.min.js" %}"></script>
</head>
<!-- Load in the body of a Go page -->
<body>
<!-- Load in the navbar template -->
{% include 'layouts/navigation.html' %}
<!-- Wrap the page content in a bootstrap container -->
<div class="container">
<!-- Load in the main page content -->
{% block content %}
{% endblock %}
</div>
<!-- Load in the footer template -->
{% include 'layouts/footer.html' %}
</body>
</html>
\ No newline at end of file
<!-- define the footer template -->
<footer class="footer">
<!-- note: this is a special css class (see styles.css) -->
<div class="text-center valign-center">
<div class="hidden-xs text-center valign-center">
<span class="text-muted">A project of
<a href="http://srct.gmu.edu/">GMU<strong> SRCT</strong></a>. |
Read and contribute to our <a href="https://git.gmu.edu/srct/go/">source code</a>. |
......@@ -9,4 +9,19 @@
Go Version 2.1.1
</span>
</div>
<div class="container text-center hidden-sm hidden-md hidden-lg">
<div class="col-sm-4 text-muted">
A project of <a href="http://srct.gmu.edu/">GMU<strong> SRCT</strong></a>.
</div>
<div class="col-sm-4 text-muted">
Read and contribute to our <a href="https://git.gmu.edu/srct/go/">source code</a>.
</div>
<div class="col-sm-4 text-muted">
Freely-licensed under <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>.
</div>
<div class="col-sm-4 text-muted">
Go Version 2.1.1
</div>
</div>
</footer>
......@@ -14,7 +14,7 @@
</button>
<!-- Go brand logo -->
<a class="navbar-brand" href="{% url 'index' %}">
<i class="fa fa-link"> Go</i>
<i class="fa fa-link"></i> Go
</a>
</div>
......
......@@ -97,12 +97,12 @@
<br></br>
<!-- Delete Button -->
<a class="button btn btn-danger btn-sm fa" data-target="#deletionModal-{{url.short}}" data-toggle="modal">
<a class="button btn btn-danger btn-sm" data-target="#deletionModal-{{url.short}}" data-toggle="modal">
<i class="fa fa-trash-o fa-lg"></i> Delete
</a>
<!-- Edit Button -->
<a href="{{domain}}edit/{{url.short}}" class="button btn btn-info btn-sm fa">
<a href="{{domain}}edit/{{url.short}}" class="button btn btn-info btn-sm">
<i class="fa fa-cog fa-lg"></i> Edit
</a>
......
......@@ -13,13 +13,13 @@ SRCT Go &bull; Account Not Approved
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-ban fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Account Not Approved</i>
</strong></h1>
Account Not Approved
</h1>
</div>
</div>
</div>
......
......@@ -27,7 +27,7 @@ SRCT Go &bull; Welcome
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><i class="fa"><i class="fa fa-link"></i> Go</i></h1>
<h1><i class="fa fa-link"></i> Go</h1>
<p class="lead">University-branded URL shortening</p>
</div>
</div>
......@@ -37,7 +37,7 @@ SRCT Go &bull; Welcome
<div class="row">
<!-- what is go? -->
<div class="col-md-4">
<h3><i class="fa">What is Go?</i></h3>
<h3>What is Go?</h3>
<legend></legend>
<p>
Go provides University-branded URL shortening for student organizations,
......@@ -46,14 +46,14 @@ SRCT Go &bull; Welcome
that can redirect to a longer URL.
<br></br>
Go is a product of the
George Mason University <a href="https://srct.gmu.edu">Student-Run Computing and Technology</a>
George Mason University <a href="https://srct.gmu.edu">Student-Run Computing and Technology</a>
student organization.
</p>
</div>
<!-- why should I use Go? -->
<div class="col-md-4">
<h3><i class="fa">Why should I use Go?</i></h3>
<h3>Why should I use Go?</h3>
<legend></legend>
<p>Go features:</p>
<ul class="fa-ul">
......@@ -78,7 +78,7 @@ SRCT Go &bull; Welcome
<!-- how do I access Go? -->
<div class="col-md-4">
<h3><i class="fa">How do I access Go?</i></h3>
<h3>How do I access Go?</h3>
<legend></legend>
<p>
In order to prevent abuse of the URL shortener, access to Go
......@@ -96,11 +96,11 @@ SRCT Go &bull; Welcome
<!-- carefully formatted login and signup buttons -->
<!-- https://files.slack.com/files-pri/T025B796J-F0KPTCTD3/spin-dhaynes-buttons.gif -->
<div class="fix row">
<div class="col-md-offset-1 col-md-4" "col-md-offset-2 col-md-4">
<div class="col-md-offset-1 col-md-4">
<a href="{% url 'go_login' %}" class="btn btn-primary btn-block">Log In</a>
</div>
<div class="col-md-offset-1 col-md-4 col-md-offset-2 col-md-4">
<div class="col-md-offset-1 col-md-4">
<a href="{% url 'signup' %}" class="btn btn-primary btn-block">Sign Up</a>
</div>
</div>
......
......@@ -13,13 +13,13 @@ SRCT Go &bull; Registration Email Sent
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-envelope-o fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Registration Email Sent</i>
</strong></h1>
Registration Email Sent
</h1>
</div>
</div>
</div>
......
......@@ -13,13 +13,13 @@ SRCT Go &bull; Link View
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<h1><strong>
<h1>
<span class="fa-stack fa-lg">
<i class="fa fa-circle fa-stack-2x"></i>
<i class="fa fa-link fa-stack-1x fa-inverse"></i>
</span>
<i class="fa">Link View</i>
</strong></h1>
Link View
</h1>
</div>
</div>
</div>
......
......@@ -6,7 +6,7 @@ from __future__ import (absolute_import, division, print_function,
from django.test import TestCase
# App Imports
from go.cas_callbacks import pfparse, pfinfo
from .cas_callbacks import pfparse, pfinfo
class CasCallbacksTest(TestCase):
"""
......
......@@ -17,8 +17,8 @@ from django.contrib.auth.models import User
from django.test import TestCase
# App Imports
from go.forms import SignupForm, URLForm, EditForm
from go.models import URL, RegisteredUser
from .forms import SignupForm, URLForm, EditForm
from .models import URL, RegisteredUser
class URLFormTest(TestCase):
"""
......
......@@ -13,7 +13,7 @@ from django.test import TestCase
from django.utils import timezone
# App Imports
from go.models import URL, RegisteredUser
from .models import URL, RegisteredUser
class RegisteredUserTest(TestCase):
"""
......
......@@ -14,7 +14,7 @@ from django.contrib.auth.models import User
from django.test import TestCase, Client
# App Imports
from go.models import URL, RegisteredUser
from .models import URL, RegisteredUser
class IndexTest(TestCase):
"""
......
......@@ -24,8 +24,8 @@ from django.utils import timezone
from ratelimit.decorators import ratelimit
# App Imports
from go.forms import SignupForm, URLForm, EditForm
from go.models import URL, RegisteredUser
from .forms import SignupForm, URLForm, EditForm
from .models import URL, RegisteredUser
def index(request):
......@@ -329,7 +329,7 @@ def delete(request, short):
url = get_object_or_404(URL, short__iexact=short)
# If the RegisteredUser is the owner of the URL
if url.owner == request.user.registereduser:
if url.owner == request.user.registereduser and request.META['HTTP_REFERER'] == request.META['HTTP_HOST']:
# remove the URL
url.delete()
# redirect to my_links
......
html {
position: relative;
min-height: 100%;
font-family: -apple-system, BlinkMacSystemFont,
"Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell",
"Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
}
body {
/* Margin bottom by footer height */
......@@ -12,7 +16,6 @@ body {
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
background-color: #f5f5f5;
}
.valign-center {
height: 60px;
......
Django>=1.11
django-crispy-forms==1.6.0
django-crispy-forms==1.6.1
django-ratelimit==1.0.1
django-redis-cache==1.6.4
git+https://github.com/bruno207/django-qrcode.git
django-redis-cache==1.7.1
git+https://github.com/dhaynespls/django-qrcode.git
git+https://github.com/kstateome/django-cas.git
git+https://github.com/bruno207/django-bootstrap3-datetimepicker.git
hashids==1.1.0
git+https://github.com/dhaynespls/django-bootstrap3-datetimepicker.git
hashids==1.2.0
mysqlclient
redis==2.10.5
requests==2.11.0
simplejson==3.8.2
requests==2.13.0
simplejson==3.10.0
six
setuptools==35.0.1
\ No newline at end of file