MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / login_required

Function login_required

Scripts/ButSystem.py:3050–3098  ·  view source on GitHub ↗

login_required. Route handler or application helper. This docstring was expanded to make future maintenance easier. Args: fn: Parameter. Returns: Varies.

(fn)

Source from the content-addressed store, hash-verified

3048 Varies.
3049"""
3050 lang = session.get("lang", "en")
3051 return "el" if lang == "el" else "en"
3052
3053@app.before_request
3054def _set_lang_on_g():
3055 """_set_lang_on_g.
3056
3057Internal helper function.
3058
3059This docstring was expanded to make future maintenance easier.
3060
3061Returns:
3062 Varies.
3063"""
3064 g.lang = get_lang()
3065
3066@app.context_processor
3067def _inject_lang():
3068 """_inject_lang.
3069
3070Internal helper function.
3071
3072This docstring was expanded to make future maintenance easier.
3073
3074Returns:
3075 Varies.
3076"""
3077 return {
3078 "lang": getattr(g, "lang", "en"),
3079 "logo_light": LOGO_LIGHT_URL,
3080 "logo_dark": LOGO_DARK_URL,
3081 "csrf_token": getattr(g, "csrf_token", csrf_token()),
3082 "csp_nonce": getattr(g, "csp_nonce", ""),
3083 "credit_line": CREDIT_LINE if "CREDIT_LINE" in globals() else WATERMARK,
3084 "ENABLE_CALLS": ENABLE_CALLS,
3085 }
3086
3087@app.route("/lang/toggle")
3088def toggle_language():
3089 """toggle_language.
3090
3091Route handler or application helper.
3092
3093This docstring was expanded to make future maintenance easier.
3094
3095Returns:
3096 Varies.
3097"""
3098 session["lang"] = "el" if get_lang() == "en" else "en"
3099 return redirect(request.referrer or (url_for("profiler") if is_logged_in() else url_for("index")))
3100
3101def _(s: str) -> str:

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected