Compare commits

...

3 Commits

Author SHA1 Message Date
796f5b44b0 Navbar works properly again 2021-09-13 16:14:18 +01:00
6458f016f0 Switch to hCapatcha 2021-09-13 16:14:05 +01:00
9ca953423f Revamp registration form 2021-09-13 16:13:47 +01:00
9 changed files with 68 additions and 71 deletions

12
Pipfile
View File

@@ -23,7 +23,6 @@ Django = "~=3.1.12"
django-debug-toolbar = "~=3.2" django-debug-toolbar = "~=3.2"
django-filter = "~=2.4.0" django-filter = "~=2.4.0"
django-ical = "~=1.7.1" django-ical = "~=1.7.1"
django-recaptcha = "~=2.0.6"
django-recurrence = "~=1.10.3" django-recurrence = "~=1.10.3"
django-registration-redux = "~=2.9" django-registration-redux = "~=2.9"
django-reversion = "~=3.0.9" django-reversion = "~=3.0.9"
@@ -78,6 +77,7 @@ zipp = "~=3.4.0"
sentry-sdk = "*" sentry-sdk = "*"
diff-match-patch = "*" diff-match-patch = "*"
python-barcode = "*" python-barcode = "*"
django-hcaptcha = "*"
[dev-packages] [dev-packages]
selenium = "~=3.141.0" selenium = "~=3.141.0"
@@ -89,14 +89,8 @@ pytest-django = "*"
pluggy = "*" pluggy = "*"
pytest-splinter = "*" pytest-splinter = "*"
pytest = "*" pytest = "*"
pytest-xdist = {extras = [ "psutil",], version = "*"}
PyPOM = {extras = [ "splinter",], version = "*"}
[requires] [requires]
python_version = "3.9" python_version = "3.9"
[dev-packages.pytest-xdist]
extras = [ "psutil",]
version = "*"
[dev-packages.PyPOM]
extras = [ "splinter",]
version = "*"

16
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "7ce63a92a53c057af0591ed6a2663f9c81e9e65bb16ca277f6b07db8c7faeea4" "sha256": "28cf82a210d555ef6791bb56e5ecf8c7ce345a85f65095d724e890fbbaa44803"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@@ -213,6 +213,13 @@
"index": "pypi", "index": "pypi",
"version": "==2.4.0" "version": "==2.4.0"
}, },
"django-hcaptcha": {
"hashes": [
"sha256:2b80197c07bb8444249bcce3758b0472d369cca309fb02d7abcd0a856431b76b"
],
"index": "pypi",
"version": "==0.1.0"
},
"django-htmlmin": { "django-htmlmin": {
"hashes": [ "hashes": [
"sha256:e41b2a2157570846645cc636a9bddde8aa3e03f6834a9211e61a17f2ed42b87e" "sha256:e41b2a2157570846645cc636a9bddde8aa3e03f6834a9211e61a17f2ed42b87e"
@@ -228,13 +235,6 @@
"index": "pypi", "index": "pypi",
"version": "==1.7.3" "version": "==1.7.3"
}, },
"django-recaptcha": {
"hashes": [
"sha256:567784963fd5400feaf92e8951d8dbbbdb4b4c48a76e225d4baa63a2c9d2cd8c"
],
"index": "pypi",
"version": "==2.0.6"
},
"django-recurrence": { "django-recurrence": {
"hashes": [ "hashes": [
"sha256:715f681f6af029ff3a8d73c7b1460abd8cbc5d5a5001efcb127032e84d9cb963", "sha256:715f681f6af029ff3a8d73c7b1460abd8cbc5d5a5001efcb127032e84d9cb963",

View File

@@ -65,8 +65,8 @@ INSTALLED_APPS = (
'debug_toolbar', 'debug_toolbar',
'registration', 'registration',
'reversion', 'reversion',
'captcha',
'widget_tweaks', 'widget_tweaks',
'hcaptcha',
) )
MIDDLEWARE = ( MIDDLEWARE = (
@@ -186,12 +186,10 @@ LOGOUT_URL = '/user/logout/'
ACCOUNT_ACTIVATION_DAYS = 7 ACCOUNT_ACTIVATION_DAYS = 7
# reCAPTCHA settings # CAPTCHA settings
RECAPTCHA_PUBLIC_KEY = env('RECAPTCHA_PUBLIC_KEY', default="6LeIxAcTAAAAAJcZVRqyHh71UMIEGNQ_MXjiZKhI") # If not set, use development key if not DEBUG:
RECAPTCHA_PRIVATE_KEY = env('RECAPTCHA_PUBLIC_KEY', default="6LeIxAcTAAAAAGG-vFI1TnRWxMZNFuojJ4WifJWe") # If not set, use development key HCAPTCHA_SITEKEY = env('HCAPTCHA_SITEKEY')
NOCAPTCHA = True HCAPTCHA_SECRET = env('HCAPTCHA_SECRET')
SILENCED_SYSTEM_CHECKS = ['captcha.recaptcha_test_key_error']
# Email # Email
EMAILER_TEST = False EMAILER_TEST = False

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

View File

@@ -4,7 +4,7 @@
{% load invoices_waiting from filters %} {% load invoices_waiting from filters %}
{% block titleheader %} {% block titleheader %}
<a class="navbar-brand" href="/">RIGS</a> <a class="navbar-brand" style="margin-left: auto; margin-right: auto;" href="/">RIGS</a>
{% endblock %} {% endblock %}
{% block titleelements %} {% block titleelements %}

View File

@@ -31,28 +31,26 @@
<a class="skip-link" href='#main'>Skip to content</a> <a class="skip-link" href='#main'>Skip to content</a>
{% include "analytics.html" %} {% include "analytics.html" %}
{% block navbar %} {% block navbar %}
<nav class="navbar navbar-expand-lg navbar-dark bg-dark flex-nowrap text-nowrap" role="navigation"> <nav class="navbar navbar-expand-lg navbar-dark bg-dark" role="navigation">
<a class="navbar-brand" href="{% if request.user.is_authenticated %}https://members.nottinghamtec.co.uk{%else%}https://nottinghamtec.co.uk{%endif%}"> <div class="container">
<a class="navbar-brand" style="position: absolute; left:0.5em; top: 2px;" href="{% if request.user.is_authenticated %}https://members.nottinghamtec.co.uk{%else%}https://nottinghamtec.co.uk{%endif%}">
<img src="{% static 'imgs/logo.webp' %}" width="40" height="40" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings" id="logo"> <img src="{% static 'imgs/logo.webp' %}" width="40" height="40" alt="TEC's Logo: Serif 'TEC' vertically next to a blue box with the words 'PA and Lighting', surrounded by graduated rings" id="logo">
</a> </a>
<div class="container" style="padding-left: 0; padding-right: 0;"> {% block titleheader %}
<div class="row"> {% endblock %}
{% block titleheader %} <button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" onclick="document.getElementById('logo').classList.toggle('d-none');">
{% endblock %} <span class="navbar-toggler-icon"></span>
<button class="navbar-toggler ml-auto" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation" onclick="document.getElementById('logo').classList.toggle('d-none');"> </button>
<span class="navbar-toggler-icon"></span> <div class="collapse navbar-collapse justify-content-between" id="navbarSupportedContent">
</button> <ul class="navbar-nav">
<div class="collapse navbar-collapse" id="navbarSupportedContent"> {% block titleelements %}
<ul class="navbar-nav"> {% endblock %}
{% block titleelements %} </ul>
{% endblock %} <ul class="navbar-nav align-self-end">
</ul> {% block titleelements_right %}
<ul class="navbar-nav ml-auto"> {% endblock %}
{% block titleelements_right %} </ul>
{% endblock %} </div>
</ul>
</div>
</div>
</div> </div>
</nav> </nav>
{% endblock %} {% endblock %}

View File

@@ -1,29 +1,36 @@
{% extends 'base_rigs.html' %} {% extends 'base_rigs.html' %}
{% load widget_tweaks %} {% load widget_tweaks %}
{% load static %}
{% block title %}Registration{% endblock %} {% block title %}Registration{% endblock %}
{% block content %} {% block content %}
<div class="col-sm-10 col-sm-offset-1"> <div style="background-image: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url({% static 'imgs/wof2014-1-small.jpg' %}); background-repeat: no-repeat; background-size: cover; width: 100vw; height: 100vh; position: relative; left: 50%; right: 50%; margin-left: -50vw; margin-right: -50vw; margin-top: -24px; padding-top: 24px;">
<h3>New User Registration</h3> <div class="container">
{% if form.errors or supplement_form.errors %} <div class="card">
<div class="alert alert-danger"> <h3 class="card-header">New User Registration</h3>
{{form.errors}} <div class="card-body">
{{supplement_form.errors}} {% if form.errors or supplement_form.errors %}
</div> <div class="alert alert-danger">
{% endif %} {{form.errors}}
{{supplement_form.errors}}
<div class="col-sm-8 col-sm-offset-2"> </div>
<form action="" method="post" class="" role="form">{% csrf_token %} {% endif %}
{% for field in form %} <div class="col-sm-8 col-sm-offset-2">
<div class="form-group"> <form method="post" role="form">{% csrf_token %}
<label for="{{ field.id_for_label }}" class="col-form-label col-sm-4">{{ field.label }}</label> {% for field in form %}
<div class="controls col-sm-8"> <div class="form-group form-row">
{% render_field field class+="form-control" placeholder=field.label %} <label for="{{ field.id_for_label }}" class="col-form-label col-sm-4">{{ field.label }}</label>
</div> <div class="controls col-sm-8">
</div> {% render_field field class+="form-control" placeholder=field.label %}
{% endfor %} </div>
<p><input type="submit" value="Register" class="btn btn-primary pull-right"></p> </div>
</form> {% endfor %}
<p><input type="submit" value="Register" class="btn btn-primary pull-right"></p>
</form>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

View File

@@ -1,4 +1,4 @@
from captcha.fields import ReCaptchaField from hcaptcha.fields import hCaptchaField
from django import forms from django import forms
from django.contrib.auth.forms import (AuthenticationForm, PasswordResetForm, from django.contrib.auth.forms import (AuthenticationForm, PasswordResetForm,
UserChangeForm, UserCreationForm) UserChangeForm, UserCreationForm)
@@ -9,7 +9,7 @@ from RIGS import models
# Registration # Registration
class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail): class ProfileRegistrationFormUniqueEmail(RegistrationFormUniqueEmail):
captcha = ReCaptchaField() hcaptcha = hCaptchaField()
class Meta: class Meta:
model = models.Profile model = models.Profile
@@ -41,7 +41,7 @@ class EmbeddedAuthenticationForm(CheckApprovedForm):
class PasswordReset(PasswordResetForm): class PasswordReset(PasswordResetForm):
captcha = ReCaptchaField(label='Captcha') hcaptcha = hCaptchaField()
class ProfileCreationForm(UserCreationForm): class ProfileCreationForm(UserCreationForm):

View File

@@ -1,4 +1,4 @@
<li class="nav-item dropdown" id="user"> <li class="nav-item dropdown align-self-end" id="user">
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Hi {{ user.first_name }} Hi {{ user.first_name }}