def get_confirmation_email_sent(session_store, schema): if not session_store.session_data.confirmation_email_count: raise NotFound try: email = url_safe_serializer().loads(request.args["email"]) except BadSignature: raise BadRequest show_send_another_email_guidance = not ConfirmationEmail.is_limit_reached( session_store.session_data) show_feedback_call_to_action = Feedback.is_enabled( schema) and not Feedback.is_limit_reached(session_store.session_data) return render_template( template="confirmation-email-sent", content={ "email": email, "send_confirmation_email_url": url_for("post_submission.send_confirmation_email"), "hide_sign_out_button": False, "show_send_another_email_guidance": show_send_another_email_guidance, "sign_out_url": url_for("session.get_sign_out"), "show_feedback_call_to_action": show_feedback_call_to_action, }, )
def get_thank_you(schema, session_store): thank_you = ThankYou(schema, session_store) if request.method == "POST": confirmation_email = thank_you.confirmation_email if not confirmation_email: return redirect(url_for(".get_thank_you")) if confirmation_email.form.validate(): return redirect( url_for( ".confirm_confirmation_email", email=confirmation_email.get_url_safe_serialized_email(), )) logger.info( "email validation error", error_message=str(confirmation_email.form.errors["email"][0]), ) show_feedback_call_to_action = Feedback.is_enabled( schema) and not Feedback.is_limit_reached(session_store.session_data) return render_template( template=thank_you.template, content={ **thank_you.get_context(), "show_feedback_call_to_action": show_feedback_call_to_action, }, survey_id=schema.json["survey_id"], page_title=thank_you.get_page_title(), )
def send_feedback(schema, session_store): try: feedback = Feedback(schema, session_store, form_data=request.form) except FeedbackNotEnabled: raise NotFound if request.method == "POST" and feedback.form.validate(): feedback.handle_post() return redirect(url_for(".get_feedback_sent")) return render_template( template="feedback", content=feedback.get_context(), page_title=feedback.get_page_title(), )