mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 14:27:12 +00:00
stitch together the login sequence better
This commit is contained in:
@@ -57,7 +57,7 @@ def expologin(request):
|
|||||||
else:
|
else:
|
||||||
# going to login page when you are already logged in
|
# going to login page when you are already logged in
|
||||||
from django.contrib.admin.templatetags import log
|
from django.contrib.admin.templatetags import log
|
||||||
return render(request, "tasks.html", {})
|
return render(request, "login/tasks.html", {})
|
||||||
|
|
||||||
# POST
|
# POST
|
||||||
username = request.POST["username"]
|
username = request.POST["username"]
|
||||||
|
|||||||
@@ -104,12 +104,12 @@ def frontpage(request):
|
|||||||
"""never seen in common practice. Logon should redirect here when this is more useful"""
|
"""never seen in common practice. Logon should redirect here when this is more useful"""
|
||||||
|
|
||||||
if request.user.is_authenticated:
|
if request.user.is_authenticated:
|
||||||
return render(request, "tasks.html")
|
return render(request, "login/tasks.html")
|
||||||
|
|
||||||
expeditions = Expedition.objects.order_by("-year")
|
expeditions = Expedition.objects.order_by("-year")
|
||||||
logbookentry = LogbookEntry
|
logbookentry = LogbookEntry
|
||||||
cave = Cave
|
cave = Cave
|
||||||
return render(request, "frontpage.html", locals())
|
return render(request, "login/frontpage.html", locals())
|
||||||
|
|
||||||
|
|
||||||
@login_required_if_public
|
@login_required_if_public
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import re
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import django.forms as forms
|
import django.forms as forms
|
||||||
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.http import HttpResponse, HttpResponseRedirect
|
from django.http import HttpResponse, HttpResponseRedirect
|
||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
@@ -19,13 +20,16 @@ from troggle.core.utils import (
|
|||||||
)
|
)
|
||||||
from troggle.core.views.editor_helpers import HTMLarea
|
from troggle.core.views.editor_helpers import HTMLarea
|
||||||
|
|
||||||
from .auth import login_required_if_public
|
|
||||||
|
|
||||||
"""The new user signup form and expo user management system in 2025.
|
"""The new user signup form and expo user management system in 2025.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
|
@login_required
|
||||||
def signup(request):
|
def signup(request):
|
||||||
|
if request.user.username in ["expo", "expoadmin"]:
|
||||||
|
return redirect("/accounts/newregister/")
|
||||||
|
# /accounts/login/?next=/signup
|
||||||
if request.method == "POST": # If the form has been submitted...
|
if request.method == "POST": # If the form has been submitted...
|
||||||
pageform = ExpoSignupForm(request.POST) # A form bound to the POST data
|
pageform = ExpoSignupForm(request.POST) # A form bound to the POST data
|
||||||
if pageform.is_valid():
|
if pageform.is_valid():
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ Here you will find information about the {{expedition.objects.count}} expedition
|
|||||||
You are not logged-in, so a few of the unpublished cave survey pages will not be visible to you. And of course you will not be able to edit anything.
|
You are not logged-in, so a few of the unpublished cave survey pages will not be visible to you. And of course you will not be able to edit anything.
|
||||||
</p>
|
</p>
|
||||||
<!-- <img src="/expofiles/photos/2007/selected/eishoehle5nial.jpg">-->
|
<!-- <img src="/expofiles/photos/2007/selected/eishoehle5nial.jpg">-->
|
||||||
<img src="/expofiles/photos/2007/selected/eishoehle4nial.jpg">
|
<img src="/expofiles/photos/2007/selected/eishoehle4nial.jpg" width="350px">
|
||||||
<p>Nial in <a href="/expofiles/photos/2007/selected/">Eishohle in 2007</a>.
|
<p>Nial in <a href="/expofiles/photos/2007/selected/">Eishohle in 2007</a>.
|
||||||
{% endblock content %}
|
{% endblock content %}
|
||||||
|
|
||||||
@@ -4,11 +4,16 @@
|
|||||||
<!-- To understand how this all works, with invisible default behaviour, see
|
<!-- To understand how this all works, with invisible default behaviour, see
|
||||||
|
|
||||||
troggle/templates/login/logout.html
|
troggle/templates/login/logout.html
|
||||||
troggle/templates/registration/
|
troggle/templates/login/register.html
|
||||||
|
troggle/templates/registration/*
|
||||||
|
|
||||||
because magic
|
because magic
|
||||||
This is because Django is Opinionated and does lots of Invisible Defaults
|
This is because Django is Opinionated and does lots of Invisible Defaults
|
||||||
-->
|
-->
|
||||||
|
<style>
|
||||||
|
input, label {font-family: monospace; font-weight: bold; text-align:right; font-size: 130%; padding: 0.5em; }
|
||||||
|
</style>
|
||||||
|
|
||||||
<div class='middle'>
|
<div class='middle'>
|
||||||
<h2>Troggle user login</h2>
|
<h2>Troggle user login</h2>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,7 +28,7 @@ This is because Django is Opinionated and does lots of Invisible Defaults
|
|||||||
<p>{{message }}</p>
|
<p>{{message }}</p>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<h3>Troggle ordinary user login - no access to Django control panel</h3>
|
<h3>Troggle login - no administrative access</h3>
|
||||||
<p>(This is using template login/index.html)
|
<p>(This is using template login/index.html)
|
||||||
<div style='width: 250px;' class='middle3 login'>
|
<div style='width: 250px;' class='middle3 login'>
|
||||||
<div class='align-center'>
|
<div class='align-center'>
|
||||||
@@ -31,14 +36,14 @@ This is because Django is Opinionated and does lots of Invisible Defaults
|
|||||||
<div class='space'></div>
|
<div class='space'></div>
|
||||||
{% if invalid %}
|
{% if invalid %}
|
||||||
<p class='error'>The username and password you provided don't match. Please try again.</p>
|
<p class='error'>The username and password you provided don't match. Please try again.</p>
|
||||||
<p>Have you <a href='/accounts/forgottenpassword/'>forgotten your password</a>?<br/>
|
<p>
|
||||||
Or perhaps <a href='/accounts/forgottenusername/'>your username</a>?</p>
|
Have you <a href='/people_ids'>forgotten your username</a>?<br/>
|
||||||
|
Or have you <a href='/accounts/password_reset/'>forgotten your password</a>?<br/>
|
||||||
<p>Neither of those links work yet, by the way, I'm only trying to *appear* helpful.
|
</p>
|
||||||
|
|
||||||
<div class='space'></div>
|
<div class='space'></div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class='align-center'>
|
<div style='width: 250px; text-align: right; '>
|
||||||
<form action="" method="post" accept-charset="utf-8">{% csrf_token %}
|
<form action="" method="post" accept-charset="utf-8">{% csrf_token %}
|
||||||
<table class='form'>
|
<table class='form'>
|
||||||
<tr><th><label for="id_username">Username:</label></th><td><input id="id_username" type="text" name="username" maxlength="30" /></td></tr>
|
<tr><th><label for="id_username">Username:</label></th><td><input id="id_username" type="text" name="username" maxlength="30" /></td></tr>
|
||||||
@@ -47,8 +52,19 @@ This is because Django is Opinionated and does lots of Invisible Defaults
|
|||||||
<div class='space'></div>
|
<div class='space'></div>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<p><input type="submit" value="Login →"></p>
|
|
||||||
|
<button class="fancybutton" style="padding: 0.5em 25px; font-size: 100%;" type = "submit" >
|
||||||
|
Login →
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<p>
|
||||||
|
Do you want to <a href="/accounts/register/">register for a personal login</a> <b>having been on expo before</b>?
|
||||||
|
<p>
|
||||||
|
or
|
||||||
|
<p>
|
||||||
|
Is this your first time here and do you want to <a href="/accounts/newregister/">register as a new user</a>?
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<hr><hr>
|
<hr><hr>
|
||||||
{{form}}
|
{{form}}
|
||||||
|
|||||||
Reference in New Issue
Block a user