save failed profilecss

pull/102/head
Aevann 2023-01-27 12:02:11 +02:00
parent d01d6e183a
commit 4c9181e0b1
2 changed files with 4 additions and 4 deletions

View File

@ -616,7 +616,7 @@ def settings_css(v):
v.css = css
g.db.add(v)
return render_template("settings/css.html", v=v, msg="Custom CSS successfully updated!")
return render_template("settings/css.html", v=v, msg="Custom CSS successfully updated!", profilecss=v.profilecss)
@app.post("/settings/profilecss")
@limiter.limit(DEFAULT_RATELIMIT_SLOWER)
@ -626,10 +626,10 @@ def settings_profilecss(v):
profilecss = request.values.get("profilecss", v.profilecss).strip().replace('\\', '').strip()[:CSS_LENGTH_LIMIT]
valid, error = validate_css(profilecss)
if not valid:
return render_template("settings/css.html", error=error, v=v)
return render_template("settings/css.html", error=error, v=v, profilecss=profilecss)
v.profilecss = profilecss
g.db.add(v)
return render_template("settings/css.html", v=v, msg="Profile CSS successfully updated!")
return render_template("settings/css.html", v=v, msg="Profile CSS successfully updated!", profilecss=v.profilecss)
@app.get("/settings/security")
@limiter.limit(DEFAULT_RATELIMIT, key_func=get_ID)

View File

@ -29,7 +29,7 @@
<div class="w-lg-100">
<form id="profile-settings-profilecss" action="/settings/profilecss" method="post">
<input hidden name="formkey" value="{{v|formkey}}">
<textarea autocomplete="off" class="form-control rounded" id="profilecss-textarea" placeholder="Custom profile CSS" rows="3" name="profilecss" form="profile-settings-profilecss" maxlength="{{CSS_LENGTH_LIMIT}}">{% if v.profilecss %}{{v.profilecss}}{% endif %}</textarea>
<textarea autocomplete="off" class="form-control rounded" id="profilecss-textarea" placeholder="Custom profile CSS" rows="3" name="profilecss" form="profile-settings-profilecss" maxlength="{{CSS_LENGTH_LIMIT}}">{% if profilecss %}{{profilecss}}{% endif %}</textarea>
<small>Limit of {{CSS_LENGTH_LIMIT}} characters</small>
<div class="d-flex mt-2">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" data-nonce="{{g.nonce}}" data-onclick="disable(this)" value="Save">