Commit 1c9f752e authored by Robert Hitt's avatar Robert Hitt

Maybe this'll fix it

parents c6955234 34c1a2d9
Pipeline #432 passed with stage
in 7 minutes and 44 seconds
......@@ -25,10 +25,22 @@ This retrieves links to the most up-to-date and secure versions of your packages
Next, with:
`$ sudo apt-get install python git`
`$ sudo apt-get install python python-dev python-pip git`
you install python and git.
**macOS (Formerly OS X)**
This tutorial uses the third party Homebrew package manager for macOS, which allows you to install packages from your terminal just as easily as you could on a Linux based system. You could use another package manager (or not use one at all), but Homebrew is highly reccomended.
To get homebrew, run the following command in a terminal: `/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)`
**Note**: You do NOT need to use `sudo` when running any Homebrew commands, and it likely won't work if you do.
Next, to make sure Homebrew is up to date, run `brew update`
Finally we can install python and git with `brew install python git`
### Cloning the Go Codebase
Now, we're going to clone down a copy of the Go codebase from [git.gmu.edu](http://git.gmu.edu/srct/go), the SRCT code respository.
......@@ -43,13 +55,28 @@ Now, on your computer, navigate to the directory in which you want to download t
Finally, install these packages from the standard repositories:
- VirtualBox
On Ubuntu:
`$ sudo apt-get install virtualbox`
You should be installing the latest VirtualBox version which as of time of writing is `5.0.24_Ubuntur108355`. You can verify the version number by running `vboxmanage --version`.
- Vagrant
`$ sudo apt-get install vagrant`
You should be installing the latest vagrant version which as of time of writing is `Vagrant 1.8.1`. You can verify the version number by running `vagrant -v`.
- Ansible
`$ sudo easy_install pip && sudo pip install ansible`
`$ sudo pip install ansible`
You should be installing the latest ansible version which as of time of writing is `ansible 2.1.1.0`. You can verify the version number by running `ansible --version`.
**macOS**
First, get VirtualBox from [VirtualBox.org](https://www.virtualbox.org/wiki/Downloads)
Then install Vagrant and Ansible with Homebrew with `brew install Caskroom/cask/vagrant Ansible`
## Developing with Vagrant
<legend></legend>
......@@ -62,15 +89,15 @@ Navigate to go/ and run:
This will setup a vm to run Go on your computer and will setup a database, install packages, etc. The first time you run `vagrant up` it may take a few minutes to setup, specifically when installing Go packages. Don't worry as progressive times it will speed up.
And that's it! Navigate to [localhost](http://127.0.0.1:8000) in your web browser to view the website.
And that's it! Navigate to [localhost:8000](http://127.0.0.1:8000) in your web browser to view the website.
### Additional Notes
### Additional Notes & Troubleshooting
The authentication service used for Go is CAS. In local development however we utilize a test server. You can log in using your CAS username for both the username and password fields.
The default superuser is _dhaynes3_ though this can be changed in _vagrantfile_ if you wish. You can run `$ vagrant provision` to apply this change. Be sure not to include that change in your commits.
For a currently undetermined reason at some points if you try to navigate to [localhost](http://127.0.0.1:8000) and you see an error like: "Conenction has been reset" then:
*Note:* For a currently undetermined reason at some points if you try to navigate to [localhost](http://127.0.0.1:8000) and you see an error like: "Conenction has been reset" then:
1. `vagrant ssh`
2. `sudo /etc/init.d/networking restart` and then `exit`
3. `vagrant provision` (may need to do twice)
......@@ -83,18 +110,6 @@ If you make any changes to _models.py_ you will need to re-provision the vm's da
Please note that this will refresh the database (as in delete everything in it).
It is also good practice to shutdown your vm when you are done:
`$ vagrant halt`
and to restart with:
`$ vagrant up`
## On Deployment
<legend></legend>
### Deploying with Vagrant
TODO
### Cron
......
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
<component name="TemplatesService">
<option name="TEMPLATE_CONFIGURATION" value="Jinja2" />
<option name="TEMPLATE_FOLDERS">
<list>
<option value="$MODULE_DIR$/go/templates" />
</list>
</option>
</component>
<component name="TestRunnerService">
<option name="PROJECT_TEST_RUNNER" value="Unittests" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="Python 2.7.12 (/usr/bin/python2.7)" project-jdk-type="Python SDK" />
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/go.iml" filepath="$PROJECT_DIR$/.idea/go.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="5102f761-e24c-4937-bddb-c2410bb41b61" name="Default" comment="" />
<ignored path="go.iws" />
<ignored path=".idea/workspace.xml" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="TRACKING_ENABLED" value="true" />
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FavoritesManager">
<favorites_list name="go" />
</component>
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="forms.py" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/go/forms.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="86" column="41" selection-start-line="86" selection-start-column="41" selection-end-line="86" selection-end-column="41" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/go/forms.py" />
</list>
</option>
</component>
<component name="JsBuildToolGruntFileManager" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsBuildToolPackageJson" detection-done="true" sorting="DEFINITION_ORDER" />
<component name="JsGulpfileManager">
<detection-done>true</detection-done>
<sorting>DEFINITION_ORDER</sorting>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="65" />
<option name="y" value="24" />
<option name="width" value="1301" />
<option name="height" value="744" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="WebServerToolWindowFactoryState" value="false" />
</component>
<component name="ShelveChangesManager" show_recycled="false">
<option name="remove_strategy" value="false" />
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="5102f761-e24c-4937-bddb-c2410bb41b61" name="Default" comment="" />
<created>1473808821648</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1473808821648</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="65" y="24" width="1301" height="744" extended-state="6" />
<editor active="false" />
<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Python Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager />
<watches-manager />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/go/forms.py">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="86" column="41" selection-start-line="86" selection-start-column="41" selection-end-line="86" selection-end-column="41" />
<folding />
</state>
</provider>
</entry>
</component>
</project>
\ No newline at end of file
......@@ -38,12 +38,22 @@ def pfinfo(uname):
pfjson = metadata.json()
try:
if len(pfjson['results']) == 1:
name_str = pfjson['results'][0]['name']
name = pfparse(name_str)
if pfjson['method'] == 'peoplefinder':
name_str = pfjson['results'][0]['name']
name = pfparse(name_str)
elif pfjson['method'] == 'ldap':
name = [pfjson['results'][0]['givenname'], pfjson['results'][0]['surname']]
else:
name = pfjson['results'][0]['name']
return name
else:
name_str = pfjson['results'][1]['name']
name = pfparse(name_str)
if pfjson['method'] == 'peoplefinder':
name_str = pfjson['results'][1]['name']
name = pfparse(name_str)
elif pfjson['method'] == 'ldap':
name = [pfjson['results'][1]['givenname'], pfjson['results'][1]['surname']]
else:
name = pfjson['results'][0]['name']
return name
# if the name is not in peoplefinder, return empty first and last name
except IndexError:
......
......@@ -12,8 +12,7 @@ from crispy_forms.helper import FormHelper
from crispy_forms.layout import Layout, Fieldset, Submit, HTML, Div, Field
from crispy_forms.bootstrap import StrictButton, PrependedText, Accordion, AccordionGroup
from bootstrap3_datetime.widgets import DateTimePicker
import datetime
from datetime import date
from datetime import date, datetime, timedelta
class URLForm(forms.ModelForm):
......@@ -89,11 +88,11 @@ class URLForm(forms.ModelForm):
label='Custom Date',
input_formats=['%m-%d-%Y'],
validators=[valid_date],
initial=lambda: datetime.now() + timedelta(days=1),
widget=DateTimePicker(
options={
"format": "MM-DD-YYYY",
"pickTime": False,
"defaultDate": (datetime.date.today() + datetime.timedelta(hours=24)).strftime("%m-%d-%Y"),
},
icon_attrs={
"class": "fa fa-calendar",
......
......@@ -18,7 +18,7 @@
<meta name="robots" content="all">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://fonts.googleapis.com/css?family=Carrois+Gothic" rel="stylesheet" type="text/css">
<link href="https://fonts.googleapis.com/css?family=Carrois+Gothic" rel="stylesheet" type="text/css">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.5.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 go_extras %}
{% load qr_tags %}
{% load go_extras %} {% load qr_tags %}
<link rel="stylesheet" type="text/css" href="../../static/css/style-link-box.css">
<link rel="stylesheet" type="text/css" href="../../style-link-box.css">
<div class="container">
<div class="col-md-8">
<h3>Go Address:</h3>
<div id="link-container" class="input-group">
<a id="link" class="form-control" href="{{domain}}{{url.short}}">{{domain}}{{url.short}}</a>
<div id="button-container" class="input-group-addon">
<button id="copy-button" type="button" class="button btn btn-default btn-xs fa" role="button"
data-clipboard-target="#link" title="Copy to Clipboard">
<i id="clipboard-icon" class="fa fa-clipboard fa-1g" aria-hidden="true"></i></button>
</div>
</div>
<br></br>
<h3>Address Details:</h3>
<strong>Target URL:</strong>
<div class="col-md-8">
<h3>Go Address:</h3>
<div id="link-container" class="input-group">
<a id="link" class="form-control" href="{{domain}}{{url.short}}">
{{domain}}{{url.short}}
</a>
<div id="button-container" class="input-group-addon">
<button id="copy-button" type="button" class="button btn btn-default btn-xs fa" role="button"
data-clipboard-target="#link" title="Copy to Clipboard">
<i id="clipboard-icon" class="fa fa-clipboard fa-1g" aria-hidden="true"></i>
</button>
</div>
</div>
<br></br>
<h3>Address Details:</h3>
<strong>Target URL:</strong>
<br />
<a href="{{url.target}}">{{url.target}}</a>
<br />
{% if url.owner == request.user.registereduser and request.user.registereduser.approved == True %}
<strong>Clicks:</strong> {{url.clicks}}
<br />
<strong>QR Code Uses:</strong> {{url.qrclicks}}
<br />
<strong>Social Media Clicks:</strong> {{url.socialclicks}}
<br />
<strong>Expires:</strong> {{url.expires|default_if_none:"Never"}}
<br></br>
<a class="button btn btn-danger btn-sm fa" data-target="#deletionModal" data-toggle="modal">
<i class="fa fa-trash-o fa-lg"></i> Delete
</a>
<!-- <a class="button btn btn-danger btn-sm fa" href="{{domain}}delete/{{url.short}}">
<i class="fa fa-trash-o fa-lg"></i> Delete</a> -->
<a tabindex="0" class="button btn btn-info btn-sm fa" role="button" data-toggle="popover" title="Not Implemented Quite Yet :(" data-content="We are working on adding this feature in a future
release of Go. If you'd like to check that progress or potentially
contribute code, head to git.gmu.edu/srct/go">
<i class="fa fa-cog"></i> Edit
</a>
<div id="deletionModal" class="modal fade" role="dialog" tabindex="-1">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color:#f5f5f5; border-radius: 7px">
<div class="modal-header" style="text-align:center;">
<h4 class="modal-title text-center" style="font-weight:bold; font-size: 21px !important;">Are you sure you would like to delete this link?</h4>
<h6 style="font-weight:500; margin-top: 0px; margin-bottom: 0px;">Deleting a link is permenant and can not be undone!</h6>
</div>
<div class="modal-body" style="padding-bottom: 80px">
<a type="button" class="btn btn-success btn-lg" style="border-width: 0px;float:left; width:49%; background-color: #A9B0AD; color: #ffffff; border-radius: 4px;" data-dismiss="modal">Cancel</a>
<a type="button" class="btn btn-danger btn-lg" href="{{domain}}delete/{{url.short}}" style="border-width: 0px; float:right; width:49%;background-color: #AC1D37; color: #ffffff; border-radius: 4px;">Delete</a>
</div>
</div>
</div>
</div>
{% endif %}
<br></br>
</div>
<div class="col-md-4">
{% with domain|add:url.short as the_url %}
{% with the_url|add:"?qr" as qr_url%}
{% qr_from_text qr_url 's' %}
{% endwith %}
{% with the_url|add:"?social" as social_url %}
<a class="share" href="http://twitter.com/share?url={{ social_url }}" target="_blank" title="Share via Twitter">
<i class="fa fa-twitter-square fa-3x"></i>
</a>
<a class="share" href="http://www.facebook.com/share.php?u={{ social_url }}" target="_blank" title="Share via Facebook">
<i class="fa fa-facebook-square fa-3x"></i>
</a>
<a class="share" href="https://plus.google.com/share?url={{ social_url }}" target="_blank" title="Share via Google+">
<i class="fa fa-google-plus-square fa-3x"></i>
</a>
<a class="share" href="http://www.linkedin.com/shareArticle?mini=true&amp;url={{ social_url }}&amp;ro=false&amp;summary=&amp;source=" target="_blank" title="Share via LinkedIn">
<i class="fa fa-linkedin-square fa-3x"></i>
</a>
{% endwith %}
{% with the_url|add:"?qr" as qr_url %}
<pre><strong>QR Downloads:</strong>
<a href="https://chart.googleapis.com/chart?cht=qr&chs=268x268&chl={{ qr_url }}" target="_blank">Small (268x268)</a>
<a href="https://chart.googleapis.com/chart?cht=qr&chs=383x383&chl={{ qr_url }}" target="_blank">Medium (383x383)</a>
<a href="https://chart.googleapis.com/chart?cht=qr&chs=547x547&chl={{ qr_url }}" target="_blank">Large (547x547)</a>
</pre>
{% endwith %}
{% endwith %}
{% if url.owner == request.user.registereduser and request.user.registereduser.approved == True %}
<strong>Clicks:</strong>
......@@ -83,13 +165,19 @@
{% endwith %}
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="../../static/css/style-link-box.css">
<script src="../../static/js/clipboard.min.js"></script>
<script src="../../static/js/copy.js"></script>
<script>
$(function () {
var option = {'trigger': 'hover'};
$('[data-toggle="popover"]').popover( option )
})
$(function() {
var option = {
'trigger': 'hover'
};
$('[data-toggle="popover"]').popover(option)
})
</script>
......@@ -2,7 +2,7 @@
{% block title %}
SRCT Go - My Links
SRCT Go &bull; My Links
{% endblock %}
......
......@@ -303,7 +303,7 @@ def useradmin(request):
for name in userlist:
todeny = RegisteredUser.objects.get(user__username__exact=name)
if settings.EMAIL_HOST and settings.EMAIL_PORT:
user_mail = todeny.user + settings.EMAIL_DOMAIN
user_mail = todeny.user.username + settings.EMAIL_DOMAIN
send_mail(
'Your Account has been Denied!',
######################
......
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