def confirm_registration(user_id, token): user_obj = users.get(user_id) if users.check_token(user_obj, users.AccountActivity.VERIFY_EMAIL_ADDR, token): users.confirm(user_obj) users.remove_token(user_obj, users.AccountActivity.VERIFY_EMAIL_ADDR) return "Success!" return "Fail!"
def confirm_registration(user_id, token): redirect_to = request.args.get("redirect_to", "%s%s" % (PLOP_DOMAIN, REGISTRATION_COMPLETE_REDIRECT)) user_obj = users.get(user_id) if users.check_token(user_obj, users.AccountActivity.VERIFY_EMAIL_ADDR, token): users.confirm(user_obj) users.remove_token(user_obj, users.AccountActivity.VERIFY_EMAIL_ADDR) return redirect(redirect_to) return redirect(url_for("login_user") + "?login=unsuccessful")
def reset_password(user_id, token): user_obj = users.get(user_id) if users.check_token(user_obj, users.AccountActivity.RESET_PASSWORD, token): #show passwd reset form if request.method == "GET": form = __passwd_reset_form() return render_template("passwd_reset.html", **{ "form": generate_form(form, **{ "method": "post" }), }) #parse reset form else: values = get_form_values(request, __passwd_reset_form()) new_passwd = values["passwd"] users.set_passwd(user_obj, new_passwd) users.remove_token(user_obj, users.AccountActivity.RESET_PASSWORD) return "Changed password!" return "Fail!"