Commit a54fc20a authored by David Haynes's avatar David Haynes 🙆
Browse files

Merge branch '2.3-dev' into go-three

parents a3592b73 0ed71ce1
......@@ -19,8 +19,21 @@ from django.utils import timezone
from hashids import Hashids #
# generate the salt and initialize Hashids
# note: the Hashids library already implements several restrictions
# on character placement, including repeating or incrementing numbers,
# or placing curse word characters adjacent to one another
similar_chars = set(['b', 'G', '6',
'g', 'q',
'l', '1', 'I',
'S', '5',
'O', '0',])
alphanumerics = set(string.ascii_letters + string.digits)
link_chars = ''.join(alphanumerics - similar_chars)
HASHIDS = Hashids(
salt="", alphabet=(string.ascii_lowercase + string.digits)
salt="", alphabet=(link_chars)
......@@ -5,7 +5,7 @@ The URLs of the project and their associated view that requests are routed to.
# Django Imports
import django.contrib.auth.views
from django.conf.urls import url
from django.urls import path
from django.contrib import admin
from django.views.decorators.cache import cache_page
from django.views.generic import TemplateView
......@@ -20,42 +20,42 @@ admin.autodiscover()
urlpatterns = [
# / - Homepage url. Cached for 1 second (this is the page you see after
# logging in, so having it show as not logged in is strange)
url(r'^$', cache_page(1)(go.views.index), name='index'),
path('', cache_page(1)(go.views.index), name='index'),
# /view/<short> - View URL data. Cached for 15 minutes
url(r'^view/(?P<short>[-\w]+)$', cache_page(60 * 15)(go.views.view), name='view'),
path('view/<slug:short>', cache_page(60 * 15)(go.views.view), name='view'),
# /about - About page. Cached for 15 minutes
url(r'^about/?$',cache_page(60 * 15)(TemplateView.as_view(template_name='core/about.html')), name='about'),
path('about',cache_page(60 * 15)(TemplateView.as_view(template_name='core/about.html')), name='about'),
# /signup - Signup page for access. Cached for 15 minutes
url(r'^signup/?$', cache_page(60 * 15)(go.views.signup), name='signup'),
path('signup', cache_page(60 * 15)(go.views.signup), name='signup'),
# /new - Create a new Go Link
url(r'^new/?$', go.views.new_link, name='new_link'),
path('new', go.views.new_link, name='new_link'),
# /my - My-Links page, view and review links.
url(r'^my/?$', go.views.my_links, name='my_links'),
path('my', go.views.my_links, name='my_links'),
# /edit/<short> - Edit link form
url(r'^edit/(?P<short>[-\w]+)$', go.views.edit, name='edit'),
path('edit/<slug:short>', go.views.edit, name='edit'),
# /delete/<short> - Delete a link, no content display.
url(r'^delete/(?P<short>[-\w]+)$', go.views.delete, name='delete'),
path('delete/<slug:short>', go.views.delete, name='delete'),
# /registered - registration complete page. Cached for 15 minutes
url(r'^registered/?$', cache_page(60 * 15)(TemplateView.as_view(template_name='registered.html')), name='registered'),
path('registered', cache_page(60 * 15)(TemplateView.as_view(template_name='registered.html')), name='registered'),
# /admin - Administrator interface.
url(r'^admin/?',, name='go_admin'),
path('admin',, name='go_admin'),
# /manage - user approval interface
url(r'^manage/?$', go.views.useradmin, name='useradmin'),
path('manage', go.views.useradmin, name='useradmin'),
# Authentication URLs
url(r'^login$', django.contrib.auth.views.login, name='go_login'),
url(r'^logout$', django.contrib.auth.views.logout, {'next_page': '/'}, name='go_logout'),
path('login', django.contrib.auth.views.login, name='go_login'),
path('logout', django.contrib.auth.views.logout, {'next_page': '/'}, name='go_logout'),
# Redirection regex.
url(r'^(?P<short>[-\w]+)$', go.views.redirection, name='redirection'),
path('<slug:short>', go.views.redirection, name='redirection'),
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