diff --git a/lglog/settings.py b/lglog/settings.py index 933c837..92e20f9 100644 --- a/lglog/settings.py +++ b/lglog/settings.py @@ -38,6 +38,8 @@ INSTALLED_APPS = [ 'django.contrib.messages', 'django.contrib.staticfiles', + 'crispy_forms', + 'lg', ] @@ -130,3 +132,12 @@ USE_TZ = True STATIC_URL = '/static/' STATIC_ROOT = BASE_DIR / 'static' + +STATICFILES_DIRS = [ + BASE_DIR / 'lglog/static', + '/usr/share/javascript', +] + +CRISPY_TEMPLATE_PACK = 'bootstrap4' + +DJANGO_TABLES2_TEMPLATE = 'django_tables2/bootstrap4.html' diff --git a/lglog/static/css/custom.css b/lglog/static/css/custom.css new file mode 100644 index 0000000..1f7cf76 --- /dev/null +++ b/lglog/static/css/custom.css @@ -0,0 +1,96 @@ +.validate:hover { + cursor: pointer; + text-decoration: underline; +} + +/* Opaque tooltip with white background */ +.tooltip.show { + opacity: 1; +} + +.tooltip-inner { + background-color: #fff; + box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .15); + border: 1px solid rgba(0, 0, 0, .250); + color: #000; + margin: 0 .5rem .25rem .5rem; + padding: 0; + width: 200px; +} + +.bs-tooltip-bottom .arrow::before { + border-bottom-color: rgba(0, 0, 0, .250); +} + +/* Fixed width picture column */ +.picture-col { + max-width: 202px; +} + +/* Limit fluid container to a max size */ +.container-fluid { + max-width: 1600px; +} + +/* Apply Bootstrap table-responsive to all Django tables */ +.table-container { + display: block; + width: 100%; + overflow-x: auto; + -webkit-overflow-scrolling: touch; +} + +/* Smaller language selector */ +select.language { + padding: 0; + background: transparent; + border: none; + height: calc(1.5em + .5rem); + color: #6c757d; + -moz-appearance: none; + width: auto; + cursor: pointer; +} + +/* Remove horizontal padding on mark */ +.mark, +mark { + padding: .2em 0; +} + +/* Make navbar more readable */ +.navbar-dark .navbar-nav .nav-link { + color: rgba(255, 255, 255, .75); +} + +/* Last BDE colors */ +.bg-primary { + background-color: rgb(0, 119, 139) !important; +} + +html { + scrollbar-color: rgba(121, 121, 123, 1) rgba(35, 35, 39, 1); +} + +body { + background-color: rgba(64, 64, 64, 1); + background-image: url(../img/background-texture.png); +} + +.btn-outline-primary:hover, +.btn-outline-primary:not(:disabled):not(.disabled).active, +.btn-outline-primary:not(:disabled):not(.disabled):active { + color: #fff; + background-color: rgb(0, 119, 139); + border-color: rgb(0, 119, 139); +} + +.btn-outline-primary { + color: rgb(0, 119, 139); + background-color: rgba(248, 249, 250, 0.9); + border-color: rgb(0, 119, 139); +} + +.turbolinks-progress-bar { + background-color: #01D3FB; +} \ No newline at end of file diff --git a/lglog/static/css/login.css b/lglog/static/css/login.css new file mode 100644 index 0000000..b1bac97 --- /dev/null +++ b/lglog/static/css/login.css @@ -0,0 +1,23 @@ +/* +Add icons to login form +Font-Awesome attribution is already done inside SVG files +*/ + +#login-form input[type="text"] { + background: #fff right 1rem top 50% / 5% no-repeat url('../img/fa-user.svg'); + padding-right: 3rem; +} + +#login-form input[type="password"] { + background: #fff right 1rem top 50% / 5% no-repeat url('../img/fa-lock.svg'); + padding-right: 3rem; +} + +#login-form select { + -moz-appearance: none; + cursor: pointer; +} + +#login-form .asteriskField { + display: none; +} diff --git a/lglog/static/img/fa-lock.svg b/lglog/static/img/fa-lock.svg new file mode 100644 index 0000000..24b8dc7 --- /dev/null +++ b/lglog/static/img/fa-lock.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lglog/static/img/fa-user.svg b/lglog/static/img/fa-user.svg new file mode 100644 index 0000000..ac145d3 --- /dev/null +++ b/lglog/static/img/fa-user.svg @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/lglog/templates/registration/logged_out.html b/lglog/templates/registration/logged_out.html new file mode 100644 index 0000000..b81c143 --- /dev/null +++ b/lglog/templates/registration/logged_out.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n %} + +{% block content %} +
+

+ {{ title }} +

+
+

{% trans "Thanks for spending some quality time with the Web site today." %}

+

{% trans 'Log in again' %}

+
+
+{% endblock %} diff --git a/lglog/templates/registration/login.html b/lglog/templates/registration/login.html new file mode 100644 index 0000000..9354293 --- /dev/null +++ b/lglog/templates/registration/login.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-2.0-or-later +{% endcomment %} +{% load i18n crispy_forms_tags static %} +{% block title %}{% trans "Log in" %}{% endblock %} + +{% block extracss %} + +{% endblock %} + +{% block content %} +
+

+ {% trans "Log in" %} +

+
+ {% if user.is_authenticated %} +
+ {% blocktrans trimmed with username=request.user.username %} + You are authenticated as {{ username }}, but are not authorized to + access this page. Would you like to login to a different account, + or with a higher permission mask? + {% endblocktrans %} +
+ {% endif %} + + {% if request.resolver_match.view_name == 'admin:login' %} +
+ {% blocktrans trimmed %} + You must be logged with a staff account with the higher mask to access Django Admin. + {% endblocktrans %} +
+ {% endif %} + +
+ {% csrf_token %} + {{ form | crispy }} + + {% trans 'Forgotten your password or username?' %} +
+
+
+{% endblock %} \ No newline at end of file diff --git a/lglog/templates/registration/password_change_done.html b/lglog/templates/registration/password_change_done.html new file mode 100644 index 0000000..bcc1a0f --- /dev/null +++ b/lglog/templates/registration/password_change_done.html @@ -0,0 +1,16 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n %} + +{% block content %} +
+

+ {{ title }} +

+
+

{% trans 'Your password was changed.' %}

+
+
+{% endblock %} diff --git a/lglog/templates/registration/password_change_form.html b/lglog/templates/registration/password_change_form.html new file mode 100644 index 0000000..45f7729 --- /dev/null +++ b/lglog/templates/registration/password_change_form.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n crispy_forms_tags %} + +{% block content %} +
+

+ {{ title }} +

+
+
{% csrf_token %} +

{% trans "Please enter your old password, for security's sake, and then enter your new password twice so we can verify you typed it in correctly." %}

+ {{ form | crispy }} + +
+
+
+{% endblock %} diff --git a/lglog/templates/registration/password_reset_complete.html b/lglog/templates/registration/password_reset_complete.html new file mode 100644 index 0000000..7e8dd74 --- /dev/null +++ b/lglog/templates/registration/password_reset_complete.html @@ -0,0 +1,19 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n %} + +{% block content %} +
+

+ {{ title }} +

+
+

{% trans "Your password has been set. You may go ahead and log in now." %}

+

+ {% trans 'Log in' %} +

+
+
+{% endblock %} diff --git a/lglog/templates/registration/password_reset_confirm.html b/lglog/templates/registration/password_reset_confirm.html new file mode 100644 index 0000000..e52762c --- /dev/null +++ b/lglog/templates/registration/password_reset_confirm.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n crispy_forms_tags %} + +{% block content %} +
+

+ {{ title }} +

+
+ {% if validlink %} +

{% trans "Please enter your new password twice so we can verify you typed it in correctly." %}

+
{% csrf_token %} + {{ form | crispy }} + +
+ {% else %} +

+ {% trans "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." %} +

+ {% endif %} +
+
+{% endblock %} \ No newline at end of file diff --git a/lglog/templates/registration/password_reset_done.html b/lglog/templates/registration/password_reset_done.html new file mode 100644 index 0000000..1f22b6d --- /dev/null +++ b/lglog/templates/registration/password_reset_done.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n %} + +{% block content %} +
+

+ {{ title }} +

+
+

{% trans "We've emailed you instructions for setting your password, if an account exists with the email you entered. You should receive them shortly." %}

+

{% trans "If you don't receive an email, please make sure you've entered the address you registered with, and check your spam folder." %}

+
+
+{% endblock %} diff --git a/lglog/templates/registration/password_reset_form.html b/lglog/templates/registration/password_reset_form.html new file mode 100644 index 0000000..639aefe --- /dev/null +++ b/lglog/templates/registration/password_reset_form.html @@ -0,0 +1,22 @@ +{% extends "base.html" %} +{% comment %} +SPDX-License-Identifier: GPL-3.0-or-later +{% endcomment %} +{% load i18n crispy_forms_tags %} + +{% block content %} +
+

+ {{ title }} +

+
+

{% trans "Forgotten your password? Enter your email address below, and we'll email instructions for setting a new one." %}

+ +
+ {% csrf_token %} + {{ form | crispy }} + +
+
+
+{% endblock %} diff --git a/requirements.txt b/requirements.txt index f309cbc..bfd2d35 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ Django~=3.1 +django-crispy-forms django-polymorphic~=3.0 django-tables2~=2.3 gunicorn~=20.0