feat: several improvements to azlux's token auth scheme #154

1. 'auth_method' in config, where users can select between
   'password' and 'token'.
2. create index for token, avoid iterating the entire user
   section when validating tokens.
3. only generate token for a user when there's no token for
   him in the db, avoid tokens fill the db.
This commit is contained in:
Terry Geng
2020-05-18 10:17:08 +08:00
parent 4017e7bff0
commit edf5495fe5
5 changed files with 64 additions and 69 deletions

View File

@ -96,14 +96,13 @@ listening_addr = 127.0.0.1
listening_port = 8181
web_logfile =
# Set this option to True to enable password protection for the web interface
require_auth = False
user =
password =
auth_method = password
user = botamusique
password = mumble
access_address = http://127.0.0.1:8181
# Set this option to match mumble user with token on flask and add a password to encrypt/sign cookies
flask_secret = ChangeThisPassword
match_mumble_user = False
[debug]
# Set ffmpeg to True if you want to display DEBUG level log of ffmpeg.
@ -259,7 +258,7 @@ cleared_tags = Removed all tags from <b>{song}</b>.
cleared_tags_from_all = Removed all tags from songs on the playlist.
shortlist_instruction = Use <i>!sl {indexes}</i> to play the item you want.
auto_paused = Use <i>!play</i> to resume music!
webpage_token= Your token to access the Bot webpage is {token}, short <a href="YOUR_URL_HERE?token={token}">URL</a>
webpage_token= Your own address to access the web interface is <a href="{address}/?token={token}">{address}/?token={token}</a>
help = <h3>Commands</h3>
<b>Control</b>