def __init__(
        self,
        questionnaire_store: QuestionnaireStore,
        schema: QuestionnaireSchema,
        session_store: SessionStore,
        serialized_email,
        form_data: Mapping,
    ):

        if not ConfirmationEmail.is_enabled(schema):
            raise ConfirmationEmailNotEnabled

        if ConfirmationEmail.is_limit_reached(
                session_store.session_data):  # type: ignore
            raise ConfirmationEmailLimitReached

        self._serialized_email = serialized_email

        try:
            email = url_safe_serializer().loads(self._serialized_email)
        except BadSignature as exc:
            raise BadRequest from exc

        self._questionnaire_store = questionnaire_store
        self._schema = schema
        self._session_store = session_store
        self._form_data = form_data
        self._email = email
        self.page_title = lazy_gettext("Confirm your email address")
示例#2
0
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_confirmation_email_sent():
    if not get_session_store().session_data.confirmation_email_count:
        raise NotFound

    email = URLParamSerializer().loads(request.args.get("email"))

    return render_template(
        template="confirmation-email-sent",
        content={
            "email":
            email,
            "send_confirmation_email_url":
            url_for("post_submission.send_confirmation_email"),
            "hide_signout_button":
            False,
            "show_send_another_email_guidance":
            not ConfirmationEmail.is_limit_reached(),
            "sign_out_url":
            url_for("session.get_sign_out"),
        },
    )