From e4f6952a5fb825d31098f8d5c5f4653f9bafcbaf Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Thu, 9 Jun 2022 15:30:29 -0400 Subject: [PATCH] completed the feature I think. modified: make_post_sell/templates/join-or-log-in.j2 modified: make_post_sell/templates/verification-challenge.j2 modified: make_post_sell/views/authentication.py --- make_post_sell/templates/join-or-log-in.j2 | 3 --- .../templates/verification-challenge.j2 | 4 ---- make_post_sell/views/authentication.py | 17 ++--------------- 3 files changed, 2 insertions(+), 22 deletions(-) diff --git a/make_post_sell/templates/join-or-log-in.j2 b/make_post_sell/templates/join-or-log-in.j2 index 5b26aa5..92aed0f 100644 --- a/make_post_sell/templates/join-or-log-in.j2 +++ b/make_post_sell/templates/join-or-log-in.j2 @@ -32,9 +32,6 @@ - {% if return_to %} - - {% endif %}

What's next? check your email to log in!

diff --git a/make_post_sell/templates/verification-challenge.j2 b/make_post_sell/templates/verification-challenge.j2 index 30e20c2..39f9700 100644 --- a/make_post_sell/templates/verification-challenge.j2 +++ b/make_post_sell/templates/verification-challenge.j2 @@ -29,10 +29,6 @@

- {% if return_to %} - - {% endif %} - diff --git a/make_post_sell/views/authentication.py b/make_post_sell/views/authentication.py index eeb8146..0d8d3e4 100644 --- a/make_post_sell/views/authentication.py +++ b/make_post_sell/views/authentication.py @@ -33,9 +33,6 @@ def join_or_log_in(request): """ _email_regex = re.compile("^[^@]+@[^@]+\.[^.@]+$") - # get the return_to uri from posted parameters. - return_to = request.params.get("return-to", "") - # get the raw OTP (one-time-password) from posted parameters. raw_otp = request.params.get("raw-otp", "") @@ -51,9 +48,6 @@ def join_or_log_in(request): return request.spam if request.user and request.user.authenticated: - # user already authenticated, return early. - if return_to: - return HTTPFound(return_to) return HTTPFound(get_referer_or_home(request)) elif email: @@ -82,8 +76,7 @@ def join_or_log_in(request): request.session.flash(msg) - #return HTTPFound(return_to) - return HTTPFound("/verification-challenge?email={}&return-to={}".format(email, return_to)) + return HTTPFound("/verification-challenge?email={}".format(email)) return { "title": "join or log in", @@ -93,9 +86,6 @@ def join_or_log_in(request): @view_config(route_name="verification-challenge", renderer="verification-challenge.j2") def verification_challenge(request): - # get the return_to uri from posted parameters. - return_to = request.params.get("return-to", "") - # get the raw OTP (one-time-password) from posted parameters. raw_otp = request.params.get("raw-otp", "") @@ -107,8 +97,6 @@ def verification_challenge(request): # get or create a User object from the posted email. user = get_or_create_user_by_email(request.dbsession, email) - print(request.params) - if "submit" in request.params: if raw_otp and user.check_password(raw_otp): # success: the user was verified. @@ -134,7 +122,7 @@ def verification_challenge(request): request.dbsession.add(user) request.dbsession.add(user.active_cart) request.dbsession.flush() - return HTTPFound(return_to) + return HTTPFound("/") else: msg = ("Invalid Verification Code", "error") @@ -144,5 +132,4 @@ def verification_challenge(request): "title": "Please Enter Verification Code", "email": email, "raw_otp": raw_otp, - "return_to": return_to, }