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
This commit is contained in:
parent
51c97c292f
commit
e4f6952a5f
3 changed files with 2 additions and 22 deletions
|
|
@ -32,9 +32,6 @@
|
|||
|
||||
<input type="submit" name="submit" id="submit" value="send verification code to email" />
|
||||
|
||||
{% if return_to %}
|
||||
<input type="hidden" name="return-to" value="{{ return_to }}" >
|
||||
{% endif %}
|
||||
</form>
|
||||
<br/>
|
||||
<p class="whats-next"><b>What's next?</b> check your email to log in!</p>
|
||||
|
|
|
|||
|
|
@ -29,10 +29,6 @@
|
|||
<br/>
|
||||
<br/>
|
||||
|
||||
{% if return_to %}
|
||||
<input type="hidden" name="return-to" value="{{ return_to }}" >
|
||||
{% endif %}
|
||||
|
||||
<input type="submit" name="submit" id="submit" value="verify code" required />
|
||||
|
||||
</form>
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue