summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/views/user_registration.py16
-rw-r--r--templates/login/register.html5
-rw-r--r--templates/person.html8
3 files changed, 22 insertions, 7 deletions
diff --git a/core/views/user_registration.py b/core/views/user_registration.py
index 902a02d..972d82b 100644
--- a/core/views/user_registration.py
+++ b/core/views/user_registration.py
@@ -28,7 +28,7 @@ def register(request, username=None):
"""To register a new user on the troggle system, similar to the "expo" user
(with cavey:beery password) but specific to an individual
"""
- current_user = request.user
+ current_user = request.user # if not logged in, this is 'AnonymousUser'
if request.method == "POST":
form = register_form(request.POST)
@@ -49,14 +49,20 @@ def register(request, username=None):
# to do, login automatically, and redirect to control panel ?
return HttpResponseRedirect("/accounts/login/")
else:
- if current_user:
+ if username:
+ if current_user.is_anonymous:
+ warning = ""
+ else:
+ warning = f"WARNING - you are logged-in as someone else '{current_user}'. You must logout and login again as '{username}' "
+ print(f"REGISTER: {warning}")
+ form = register_form(initial={"visible": "True", "username": username} )
+
+ elif current_user:
form = register_form(initial={"visible": "True", "username": current_user.username})
- elif username:
- form = register_form(initial={"visible": "True", "username": username})
else:
form = register_form(initial={"visible": "True"})
- return render(request, "login/register.html", {"form": form})
+ return render(request, "login/register.html", {"form": form, "warning": warning})
def save_users(request, updated_user, email):
f = get_encryptor()
diff --git a/templates/login/register.html b/templates/login/register.html
index 0670894..539306e 100644
--- a/templates/login/register.html
+++ b/templates/login/register.html
@@ -52,7 +52,10 @@ You are not logged in as the user you are attempting to re-register.
<p>This will eventually sign you up automatically to the
<a href="https://lists.wookware.org/cgi-bin/mailman/roster/expo">expo email list</a>.
So type in the same email address that you use there.
-
+<p>
+<span style="color:red">
+{{ warning }}
+</span>
<div style='width: 700px; font-family: monospace; font-weight: bold; font-size: 150%; text-align: right; '>
<form method="post" accept-charset="utf-8">{% csrf_token %}
diff --git a/templates/person.html b/templates/person.html
index 036a338..c96b410 100644
--- a/templates/person.html
+++ b/templates/person.html
@@ -37,7 +37,13 @@
</table>
<h3>Surveys done</h3>
Wallets and surveys mentioning <a href="/wallets/person/{{person}}">{{person.fullname|safe}}</a><br>
-
+{% if person.user %}
+This person has a 'troggle user' logon '{{person.user}}' and a registered email address. <br />
+<a href="/accounts/register/{{person.slug}}">RE-REGISTER</a> but only after logging-on as '{{person.user}}'
+{% else %}
+<a href="/accounts/register/{{person.slug}}">REGISTER</a> as a troggle user
+{% endif %}
+<br />
{% if person.blurb %}
{{person.blurb|safe}}
{% else %}