mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-17 12:47:35 +00:00
stitch together the login sequence better
This commit is contained in:
@@ -57,7 +57,7 @@ def expologin(request):
|
||||
else:
|
||||
# going to login page when you are already logged in
|
||||
from django.contrib.admin.templatetags import log
|
||||
return render(request, "tasks.html", {})
|
||||
return render(request, "login/tasks.html", {})
|
||||
|
||||
# POST
|
||||
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"""
|
||||
|
||||
if request.user.is_authenticated:
|
||||
return render(request, "tasks.html")
|
||||
return render(request, "login/tasks.html")
|
||||
|
||||
expeditions = Expedition.objects.order_by("-year")
|
||||
logbookentry = LogbookEntry
|
||||
cave = Cave
|
||||
return render(request, "frontpage.html", locals())
|
||||
return render(request, "login/frontpage.html", locals())
|
||||
|
||||
|
||||
@login_required_if_public
|
||||
|
||||
@@ -3,6 +3,7 @@ import re
|
||||
from pathlib import Path
|
||||
|
||||
import django.forms as forms
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import redirect, render
|
||||
from django.urls import reverse
|
||||
@@ -19,13 +20,16 @@ from troggle.core.utils import (
|
||||
)
|
||||
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.
|
||||
"""
|
||||
|
||||
@ensure_csrf_cookie
|
||||
@login_required
|
||||
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...
|
||||
pageform = ExpoSignupForm(request.POST) # A form bound to the POST data
|
||||
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.
|
||||
</p>
|
||||
<!-- <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>.
|
||||
{% endblock content %}
|
||||
|
||||
@@ -4,11 +4,16 @@
|
||||
<!-- To understand how this all works, with invisible default behaviour, see
|
||||
|
||||
troggle/templates/login/logout.html
|
||||
troggle/templates/registration/
|
||||
troggle/templates/login/register.html
|
||||
troggle/templates/registration/*
|
||||
|
||||
because magic
|
||||
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'>
|
||||
<h2>Troggle user login</h2>
|
||||
</div>
|
||||
@@ -23,7 +28,7 @@ This is because Django is Opinionated and does lots of Invisible Defaults
|
||||
<p>{{message }}</p>
|
||||
</div>
|
||||
{% 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)
|
||||
<div style='width: 250px;' class='middle3 login'>
|
||||
<div class='align-center'>
|
||||
@@ -31,14 +36,14 @@ This is because Django is Opinionated and does lots of Invisible Defaults
|
||||
<div class='space'></div>
|
||||
{% if invalid %}
|
||||
<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/>
|
||||
Or perhaps <a href='/accounts/forgottenusername/'>your username</a>?</p>
|
||||
|
||||
<p>Neither of those links work yet, by the way, I'm only trying to *appear* helpful.
|
||||
<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>
|
||||
|
||||
<div class='space'></div>
|
||||
{% endif %}
|
||||
<div class='align-center'>
|
||||
<div style='width: 250px; text-align: right; '>
|
||||
<form action="" method="post" accept-charset="utf-8">{% csrf_token %}
|
||||
<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>
|
||||
@@ -47,8 +52,19 @@ This is because Django is Opinionated and does lots of Invisible Defaults
|
||||
<div class='space'></div>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
<hr><hr>
|
||||
{{form}}
|
||||
|
||||
Reference in New Issue
Block a user