Commit fc6fdb80 authored by Zac Wood's avatar Zac Wood

Merge branch 'v2.3' into 'master'

V2.3

See merge request !140
parents 823fe4ea bce41124
Pipeline #5325 passed with stages
in 2 minutes and 1 second
GO_ENV=development
GO_ALLOWED_HOSTS=*
GO_EMAIL_DOMAIN=@masonlive.gmu.edu
GO_CAS_URL=https://login.gmu.edu/
GO_DB_NAME=go
GO_DB_USER=go
GO_DB_PASSWORD=go
GO_DB_HOST=localhost
GO_DB_PORT=3306
GO_EMAIL_HOST=
GO_EMAIL_PORT=
GO_EMAIL_HOST_USER=
GO_EMAIL_HOST_PASSWORD=
GO_EMAIL_FROM=
GO_EMAIL_TO=
GO_SECRET_KEY=spookyspecret
GO_SLACK_URL=
superuser=zwood2
......@@ -5,6 +5,7 @@ services:
stages:
- test
- lint
- build
variables:
MYSQL_DATABASE: go
......@@ -49,3 +50,15 @@ Go-flake8:
script:
- pip install flake8
- flake8 go/ --statistics --exit-zero
build:
stage: build
retry: 2
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile.prod --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
only:
- tags
FROM python:3.6
FROM python:3.6.9
ENV PYTHONUNBUFFERED 1
RUN apt-get update
RUN apt-get install netcat python3-dev default-libmysqlclient-dev -y
# downgrade openssl security for login.gmu.edu compatibility
RUN sed -i -e 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
RUN mkdir /go
WORKDIR /go
ADD /requirements/ /go/
......
FROM python:3.7
ENV PYTHONUNBUFFERED 1
RUN apt-get update
RUN apt-get install netcat python3-dev default-libmysqlclient-dev -y
# downgrade openssl security for login.gmu.edu compatibility
RUN sed -i -e 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
RUN mkdir /go
WORKDIR /go
ADD /requirements/ /go/
RUN pip install -r prod.txt
ADD . /go/
RUN mkdir /static
......@@ -5,12 +5,13 @@ services:
restart: always
ports:
- '8000:8000'
command: /bin/bash ./startup.sh -python go/manage.py runserver 0.0.0.0:8000
command: /bin/bash ./startup.sh
volumes:
- .:/go
depends_on:
- db
environment:
- DOCKER=true
- GO_ENV=development
- GO_ALLOWED_HOSTS=*
- GO_EMAIL_DOMAIN=@masonlive.gmu.edu
......
This diff is collapsed.
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- load django crispy forms' tags -->
{% load crispy_forms_tags %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; Edit Link
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<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>
Edit Link
</h1>
</div>
</div>
</div>
<!-- call django crispy forms to render the go link creation form here -->
{% crispy form %}
<!-- load some JS to hide/show the custom date field -->
<script src="{% static "js/new_link.js" %}"></script>
{% endblock %}
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- load django crispy forms' tags -->
{% load crispy_forms_tags %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; New Link
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<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>
Shorten URL
</h1>
</div>
</div>
</div>
<!-- call django crispy forms to render the go link creation form here -->
{% crispy form %}
<!-- load some JS to hide/show the custom date field -->
<script src="{% static "js/new_link.js" %}"></script>
{% endblock %}
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- load django crispy forms' tags -->
{% load crispy_forms_tags %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; Apply
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<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>
Apply to Go
</h1>
</div>
</div>
</div>
<!-- Define the div that describes why we need a signup process -->
<div class="row">
<div class="col-md-12">
<p>
In order to prevent abuse of the URL Shortner, users must be manually approved.
<br></br>
You will need to list the organization you represent and, while optional, we would like to know
<br />
why you would like to use Go and
some examples where you would use this service.
<br></br>
Please indicate below if you are interested.
</p>
<br />
<legend></legend>
</div>
</div>
<!-- call django crispy forms to render the go signup form here -->
{% crispy form %}
{% endblock %}
<!-- Custom definition for accordian-group -->
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
{{ div.name }}
</h4>
</div>
<div id="{{ div.css_id }}" class="panel-collapse collapse{% if div.active %} in{% endif %}" >
<div class="panel-body">
{{ fields|safe }}
</div>
</div>
</div>
<br />
<!-- Custom definition for accordian -->
<div class="panel-group" id="{{ accordion.css_id }}">
{{ content|safe }}
</div>
<!-- Custom definition for the date field in the link creation form -->
{% load crispy_forms_field %}
{% if field.is_hidden %}
{{ field }}
{% else %}
{% if field|is_checkbox %}
<div class="form-group">
{% if label_class %}
<div class="controls col-{{ bootstrap_device_type }}-offset-{{ label_size }} {{ field_class }}">
{% endif %}
{% endif %}
<{% if tag %}{{ tag }}{% else %}div{% endif %} id="div_{{ field.auto_id }}" {% if not field|is_checkbox %}class="form-group{% else %}class="checkbox{% endif %}{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors%}{% if field.errors %} has-error{% endif %}{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and not field|is_checkbox and form_show_labels %}
<label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}
{% if field|is_checkboxselectmultiple %}
{% include 'bootstrap3/layout/checkboxselectmultiple.html' %}
{% endif %}
{% if field|is_radioselect %}
{% include 'bootstrap3/layout/radioselect.html' %}
{% endif %}
{% if not field|is_checkboxselectmultiple and not field|is_radioselect %}
{% if field|is_checkbox and form_show_labels %}
<label for="{{ field.id_for_label }}" class="{% if field.field.required %} requiredField{% endif %}">
{% crispy_field field %}
{{ field.label|safe }}
{% include 'bootstrap3/layout/help_text_and_errors.html' %}
</label>
{% else %}
<div class="controls col-md-2">
{% crispy_field field %}
{% include 'bootstrap3/layout/help_text_and_errors.html' %}
</div>
{% endif %}
{% endif %}
</{% if tag %}{{ tag }}{% else %}div{% endif %}>
{% if field|is_checkbox %}
{% if label_class %}
</div>
{% endif %}
</div>
{% endif %}
{% endif %}
<!-- Custom definition for prepended text -->
{% load crispy_forms_field %}
{% if field.is_hidden %}
{{ field }}
{% else %}
<div id="div_{{ field.auto_id }}" class="form-group{% if wrapper_class %} {{ wrapper_class }}{% endif %}{% if form_show_errors and field.errors %} has-error{% endif %}{% if field.css_classes %} {{ field.css_classes }}{% endif %}">
{% if field.label and form_show_labels %}
<label for="{{ field.id_for_label }}" class="control-label {{ label_class }}{% if field.field.required %} requiredField{% endif %}">
{{ field.label|safe }}{% if field.field.required %}<span class="asteriskField">*</span>{% endif %}
</label>
{% endif %}
<div class="controls col-md-4">
{% if field|is_select %}
{% if crispy_prepended_text %}<span class="input-group{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_prepended_text|safe }}</span>{% endif %}
{% crispy_field field %}
{% if crispy_appended_text %}<span class="input-group{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_appended_text|safe }}</span>{% endif %}
{% else %}
<div class="input-group">
{% if crispy_prepended_text %}<span class="input-group-addon{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_prepended_text|safe }}</span>{% endif %}
{% crispy_field field %}
{% if crispy_appended_text %}<span class="input-group-addon{% if active %} active{% endif %}{% if input_size %} {{ input_size }}{% endif %}">{{ crispy_appended_text|safe }}</span>{% endif %}
</div>
{% endif %}
{% include 'bootstrap3/layout/help_text_and_errors.html' %}
</div>
</div>
{% endif %}
......@@ -9,6 +9,8 @@ SRCT Go &bull; My Links
<!-- define the content block for the page -->
{% block content %}
{% load staticfiles %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
......
......@@ -5,7 +5,7 @@
<!DOCTYPE html>
<!-- Start the HTML page for Go -->
<html>
<html lang="en-us">
<!-- load in our header content for every page -->
<head>
<!-- load in the title block defined on each html page -->
......@@ -24,7 +24,6 @@
<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">
......@@ -34,10 +33,8 @@
<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:title" content="SRCT Go">
<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" %}" />
......@@ -46,26 +43,25 @@
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>
<!-- Matomo -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//matomo.srct.gmu.edu/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '4']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//matomo.srct.gmu.edu/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '4']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
......@@ -84,4 +80,4 @@
<!-- Load in the footer template -->
{% include 'layouts/footer.html' %}
</body>
</html>
\ No newline at end of file
</html>
......@@ -2,7 +2,7 @@
{% load go_extras %}
<!-- define our navbar -->
<div class="navbar navbar-default">
<nav class="navbar navbar-default">
<!-- define the main "header" of the navbar -->
<div class="navbar-header" style="margin-left:5%;">
<!-- responsive hamburger menu -->
......@@ -62,4 +62,4 @@
{% endif %}
</ul>
</div>
</div>
</nav>
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- Tell Django to load static files -->
{% load staticfiles %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; New Link
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<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>
Shorten URL
</h1>
</div>
</div>
</div>
<form class="form-horizontal" action="{{ form.action }}" method="post">
{% csrf_token %}
{{ form.non_field_errors }}
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
Step 1: Long URL
</h4>
</div>
<div class="panel-collapse">
<div class="panel-body">
<div >
<h4>{{ form.target_title }}</h4>
<br />
<div class="form-group {% if form.short.errors %} has-error {% endif %}">
{{ form.target.errors }}
<label
class="control-label col-md-1"
for="{{ form.target.id_for_label }}"
>
{{ form.target.label }}
</label>
<div class="controls col-md-6">
{{ form.target }}
</div>
{% for error in form.target.errors %}
<span class="help-block"><strong>{{ error }}</strong></span>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
Step 2: Short URL
</h4>
</div>
<div class="panel-collapse">
<div class="panel-body">
<div >
<h4>{{ form.short_title }}</h4>
<br />
<div class="form-group {% if form.short.errors %} has-error {% endif %}">
<label class="control-label col-md-1" for="{{ form.short.id_for_label }}">{{ form.short.label }}</label>
<div class="controls col-md-6">
<div class="input-group">
<span class="input-group-addon">https://go.gmu.edu/</span>
{{ form.short }}
</div>
{% for error in form.short.errors %}
<span class="help-block"><strong>{{ error }}</strong></span>
{% endfor %}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
Step 3: URL Expiration
</h4>
</div>
<div class="panel-collapse" >
<div class="panel-body">
<div >
<h4>{{ form.expires_title }}</h4>
<br />
<div class="form-group">
<label class="control-label col-md-1" for="{{ form.expires.id_for_label }}">{{ form.expires.label }}</label>
<div class="controls col-md-6">
{{ form.expires }}
</div>
</div>
</div>
</div>
</div>
</div>
<input type="submit" class="btn btn-primary btn-md col-md-4" value="Submit">
</form>
<!-- load some JS to hide/show the custom date field -->
<script src="{% static "js/new_link.js" %}"></script>
{% endblock %}
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; Account Not Approved
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<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>
Account Not Approved
</h1>
</div>
</div>
</div>
<!-- define the div that explains why you need to be registered -->
<div class="row">
<div class="col-md-12">
<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>
<br />
<p>
{% if not request.user.registereduser.registered %}
If you have not done so, you may <a href="{% url 'signup' %}">sign up</a>
for an account.
<br></br>
This process takes time. Please be patient.
{% else %}
According to our database you have registered, but are not yet approved, to use Go.
<br />
This process takes time. Please be patient.
{% endif %}
</p>
<br/><br/>
</div>
</div>
{% endblock %}
......@@ -88,7 +88,7 @@ SRCT Go &bull; Welcome
<br />
<hr />
<!-- carefully formatted login and signup buttons -->
<!-- carefully formatted login button -->
<!-- https://files.slack.com/files-pri/T025B796J-F0KPTCTD3/spin-dhaynes-buttons.gif -->
<div class="fix row">
<div class="col">
......
<!-- include the base html template -->
{% extends 'layouts/base.html' %}
<!-- define the page title block -->
{% block title %}
SRCT Go &bull; Registration Email Sent
{% endblock %}
<!-- define the content block for the page -->
{% block content %}
<!-- define the page header div -->
<div class="page-header" id="banner">
<div class="row">
<div class="col-md-12">
<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>
Registration Email Sent
</h1>
</div>
</div>
</div>
<!-- define the div that tells the user that they have registered -->
<div class="row">
<div class="col-md-12">