コード例 #1
0
def plugin_report(uuid):
    if request.method == "POST":
        if "description" in request.form:
            kelp_plugin_repo.create_plugin_report(
                uuid, session.get("username"), request.form.get("description"),
                request.form.get("type"))

        return render_template("plugins/plugins_report.html", success=True)

    return render_template("plugins/plugins_report.html",
                           plugin=kelp_plugin_repo.get_plugin_by_uuid(uuid))
コード例 #2
0
def send_user_password_reset_email(receiver, code):
    email_content = MIMEMultipart("alternative")
    email_content.attach(
        MIMEText(
            render_template("email_templates/password_reset_email.html",
                            code=code), "html"))

    send_email(receiver, email_content, "Password Reset")
コード例 #3
0
def send_verification_email(receiver, verification_code):
    email_content = MIMEMultipart("alternative")
    email_content.attach(
        MIMEText(
            render_template("email_templates/verification_email.html",
                            code=verification_code), "html"))

    send_email(receiver, email_content, "Account Verification")
コード例 #4
0
def extensions_nav():
    if "get_modules" in request.args:
        return api_utils.craft_response(
            kelp_module_repo.get_all_modules(int(request.args.get("page")),
                                             int(request.args.get("amount"))),
            200)

    if "picture" in request.args:
        if request.args.get("picture") == "module_uuid":
            return api_utils.empty_success()
        return kelp_module_repo.get_module_picture(request.args.get("picture"))
    return render_template("extensions/extensions_nav.html")
コード例 #5
0
def plugins_new():
    if request.method == "POST" and "plugin_create" in request.form:
        return api_utils.craft_response(
            kelp_plugin_repo.create_plugin(
                request.form.get("plugin_name"),
                session.get("username"),
                request.form.get("plugin_short_description"),
                request.form.get("plugin_description"),
                request.files.get("plugin_icon"),
                request.files.get("plugin_banner"),
                (request.form.get("plugin_tags") or "").split(","),
            ), StopCodes.Success.OK)
    return render_template("plugins/plugins_new.html",
                           tags=kelp_plugin_repo.get_all_tags())
コード例 #6
0
def send_user_password_reset_email(receiver, code):
    """
    Sends the password reset email to the given recipient.

    :param receiver:    The email address of the user you want to send the email to.
                        A user name or uuid is not valid here.
    :param code:        The password reset code to apply to display in the email.
    """
    email_content = MIMEMultipart("alternative")
    email_content.attach(
        MIMEText(
            render_template("email_templates/password_reset_email.html",
                            code=code), "html"))

    send_email(receiver, email_content, "Password Reset")
コード例 #7
0
def send_verification_email(receiver, verification_code):
    """
    Sends the account verification email to a given email address.
    This function automatically constructs the html content for the page,
    so you only have to pass the verification code, which will then be inserted
    accordingly.

    :param receiver:            The email address of the user you want to send the
                                email to. A user name/uuid is not valid here.
    :param verification_code:   The verification code to send to the user.
    """
    email_content = MIMEMultipart("alternative")
    email_content.attach(
        MIMEText(
            render_template("email_templates/verification_email.html",
                            code=verification_code), "html"))

    send_email(receiver, email_content, "Account Verification")
コード例 #8
0
def plugins_nav():
    if "get_plugins" in request.args:
        if "tags" in request.args or "q" in request.args:
            return api_utils.craft_complex_response(
                kelp_plugin_repo.filter_plugins_by(
                    int(request.args.get("page")),
                    int(request.args.get("amount")),
                    request.args.get("q") or "", (request.args.get("tags")
                                                  or "").split(","),
                    read_count=True), StopCodes.Success.OK)
        return api_utils.craft_response(
            kelp_plugin_repo.get_all_plugins(int(request.args.get("page")),
                                             int(request.args.get("amount"))),
            StopCodes.Success.OK)
    if "get_tags" in request.args:
        return api_utils.craft_response(kelp_plugin_repo.get_all_tags(),
                                        StopCodes.Success.OK)

    if "icon" in request.args:
        return kelp_plugin_repo.get_plugin_icon(request.args.get("icon"))
    if "banner" in request.args:
        return kelp_plugin_repo.get_plugin_banner(request.args.get("banner"))

    return render_template("plugins/plugins_nav.html")
コード例 #9
0
def plugins_page(uuid):
    return render_template("plugins/plugins_page.html",
                           plugin=kelp_plugin_repo.get_plugin_by_uuid(uuid),
                           files=kelp_plugin_repo.get_plugin_file_list(uuid),
                           preview=request.args.get("preview") is not None)
コード例 #10
0
def extensions_page(uuid):
    return render_template("extensions/extensions_page.html",
                           module=kelp_module_repo.get_module_by_uuid(uuid),
                           files=kelp_module_repo.get_module_file_list(uuid))
コード例 #11
0
ファイル: apis.py プロジェクト: lianjy357/OK_Family_back
def home():
    return render_template('index.html')