-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Preference page #42
Comments
What preferences do we want?Custom time limit for auto log outI would like to increase the time before logging out. Toggle light/dark modeUsing bootstrap we should be easily able to add a toggle light and dark mode.
|
I added some fields back on the 4th JUNNE but now I am not getting anything |
So the blueprint for /settings needed to be added to create_app(). Yeah, are you looking to use flask-login? Was that from you or @Rachie94 ? |
Mine was just a page with 2 fields as I had little time. but right now I am getting an error |
This wasn't you? login_manager = LoginManager()
login_manager.init_app(app)
bp = Blueprint("settings", __name__, url_prefix="/setting", template_folder="templates")
@bp.route("/", methods=["GET", "POST"])
@login_required
def settings():
if request.method == "POST":
vault_timeout = request.form.get("vaultTimeout", default="00:05:00")
theme_id = request.form.get("themeId", default="light")
settings_html = request.form.get(
"settingsHtml", default=""
) # Get HTML content from the form
try:
conn = get_db()
cursor = conn.cursor()
cursor.execute(
"REPLACE INTO preferences (user_id, vault_timeout, theme_id, settings_html) VALUES (?, ?, ?, ?)",
(
current_user.id,
vault_timeout,
theme_id,
settings_html,
), # Use current_user.id to get user_id
)
conn.commit()
cursor.close()
conn.close()
flash("Preferences saved successfully", "success")
except Exception as e:
flash(f"Failed to save preferences: {str(e)}", "danger")
return redirect(url_for("settings.settings"))
return render_template("settings.html")``` |
I think so.. |
Think its fixed now. Try git fetch on development branch. |
I now have 2 "settings" links and both work Not sure where the "other" is coming from |
I updated to use `{ URL_for('settings.settings')}` and forgot to remove the old link.
Ill remove in next push
12 Jun 2024 21:23:29 Angel De Luis ***@***.***>:
…
I now have 2 "settings" links and both work Not sure where the "other" is coming from
—
Reply to this email directly, view it on GitHub[#42 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AG7KV6HJ4YDVMRM27YGGC43ZHCU4DAVCNFSM6AAAAABI2GLM36VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNRTHAZTINZRHA].
You are receiving this because you commented.
[Tracking image][https://github.com/notifications/beacon/AG7KV6GLYTKCT4QRWMY43GDZHCU4DA5CNFSM6AAAAABI2GLM36WGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTUA7F7V4.gif]
|
Add Preference pages and link fields to DB
The text was updated successfully, but these errors were encountered: