mirror of
https://github.com/PhoenixTwoFive/karaoqueue.git
synced 2025-05-18 18:41:48 +02:00
Admin credentials can be changed via settings
This commit is contained in:
parent
16cb9e7d5a
commit
12207c1246
@ -83,6 +83,9 @@ def settings_post():
|
||||
entryquota = request.form.get("entryquota")
|
||||
maxqueue = request.form.get("maxqueue")
|
||||
theme = request.form.get("theme")
|
||||
username = request.form.get("username")
|
||||
password = request.form.get("password")
|
||||
changed_credentials = False
|
||||
if entryquota.isnumeric() and int(entryquota) > 0: # type: ignore
|
||||
app.config['ENTRY_QUOTA'] = int(entryquota) # type: ignore
|
||||
else:
|
||||
@ -91,14 +94,21 @@ def settings_post():
|
||||
app.config['MAX_QUEUE'] = int(maxqueue) # type: ignore
|
||||
else:
|
||||
abort(400)
|
||||
if theme in helpers.get_themes():
|
||||
app.config['THEME'] = theme
|
||||
if theme is not None and theme in helpers.get_themes():
|
||||
helpers.set_theme(app,theme)
|
||||
else:
|
||||
abort(400)
|
||||
|
||||
if username != "" and username != app.config['BASIC_AUTH_USERNAME']:
|
||||
app.config['BASIC_AUTH_USERNAME'] = username
|
||||
changed_credentials = True
|
||||
if password != "":
|
||||
app.config['BASIC_AUTH_PASSWORD'] = password
|
||||
changed_credentials = True
|
||||
helpers.persist_config(app=app)
|
||||
|
||||
return render_template('settings.html', app=app, auth=basic_auth.authenticate())
|
||||
if changed_credentials:
|
||||
return redirect("/")
|
||||
else:
|
||||
return render_template('settings.html', app=app, auth=basic_auth.authenticate(), themes=helpers.get_themes())
|
||||
|
||||
|
||||
@app.route("/api/queue")
|
||||
|
@ -18,6 +18,18 @@
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<i class="fas fa-exclamation-triangle mr-1"></i>
|
||||
<strong>Warnung:</strong> Änderungen an den folgenden Einstellungen führen zu einer sofortigen Abmeldung!
|
||||
</div>
|
||||
<p>
|
||||
<label for="username">Benutzername</label>
|
||||
<input type="text" class="form-control" id="username" name="username" value={{app.config['BASIC_AUTH_USERNAME']}}>
|
||||
</p>
|
||||
<p>
|
||||
<label for="password">Passwort ändern</label>
|
||||
<input type="password" class="form-control" id="password" name="password">
|
||||
</p>
|
||||
<input type="submit" class="btn btn-primary mr-1 mb-2" value="Einstellungen anwenden">
|
||||
</form>
|
||||
<details>
|
||||
|
Loading…
x
Reference in New Issue
Block a user