mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 05:47:15 +00:00
notes made, work still to do
This commit is contained in:
@@ -141,20 +141,26 @@ def register(request, url_username=None):
|
|||||||
"""
|
"""
|
||||||
warning = ""
|
warning = ""
|
||||||
initial_values={"visible-passwords": "True"}
|
initial_values={"visible-passwords": "True"}
|
||||||
|
print(f"{url_username=}")
|
||||||
|
|
||||||
logged_in = (identified_login := is_identified_user(request.user))
|
logged_in = (identified_login := is_identified_user(request.user))
|
||||||
if logged_in:
|
if logged_in:
|
||||||
# logged in as a known real person with a User logon
|
# logged in as a known real person with a User logon
|
||||||
|
print(f"Already logged in as {identified_login=}, redirecting to re_register_email()")
|
||||||
return re_register_email(request) # discarding url_username
|
return re_register_email(request) # discarding url_username
|
||||||
|
|
||||||
if not request.user.is_anonymous:
|
if not request.user.is_anonymous:
|
||||||
# logged in as expo or expoadmin, so logout invisibly before we do anything
|
# Anonymous users are not logged in as anybody.
|
||||||
|
print(f"user is logged in as somebody (but not an identified person, so 'expo'), redirecting to expologout()")
|
||||||
|
# logged in as expo or expoadmin, or as a real person, so logout invisibly before we do anything
|
||||||
expologout(request) # returns a response, which we discard
|
expologout(request) # returns a response, which we discard
|
||||||
|
|
||||||
if url_username: # if provided in URL
|
if url_username: # if provided in URL
|
||||||
|
print(url_username, Person.objects.filter(slug=url_username).count())
|
||||||
|
# This is where we need to check that this url_username has or has not already been registered.
|
||||||
|
# to do..
|
||||||
if Person.objects.filter(slug=url_username).count() != 1:
|
if Person.objects.filter(slug=url_username).count() != 1:
|
||||||
# not an old expoer, so redirect to the other form
|
# not an old expoer, so redirect to the other form
|
||||||
print(url_username, Person.objects.filter(slug=url_username).count())
|
|
||||||
return HttpResponseRedirect("/accounts/newregister/")
|
return HttpResponseRedirect("/accounts/newregister/")
|
||||||
|
|
||||||
initial_values.update({"username": url_username})
|
initial_values.update({"username": url_username})
|
||||||
|
|||||||
Reference in New Issue
Block a user