updated something

This commit is contained in:
Ske087
2025-02-15 21:27:28 +02:00
parent 18dfc14391
commit fe165305fc
8 changed files with 25 additions and 6 deletions

Binary file not shown.

18
app.py
View File

@@ -56,6 +56,7 @@ class Player(db.Model):
username = db.Column(db.String(80), unique=True, nullable=False) username = db.Column(db.String(80), unique=True, nullable=False)
hostname = db.Column(db.String(120), unique=True, nullable=False) hostname = db.Column(db.String(120), unique=True, nullable=False)
password = db.Column(db.String(120), nullable=False) password = db.Column(db.String(120), nullable=False)
quickconnect_password = db.Column(db.String(120), nullable=False)
class Group(db.Model): class Group(db.Model):
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
@@ -349,10 +350,18 @@ def player_fullscreen(player_id):
if request.method == 'POST': if request.method == 'POST':
hostname = request.form['hostname'] hostname = request.form['hostname']
password = request.form['password'] password = request.form['password']
if player.hostname == hostname and bcrypt.check_password_hash(player.password, password): quickconnect_password = request.form.get('quickconnect_password')
authenticated = True
if quickconnect_password:
if player.hostname == hostname and bcrypt.check_password_hash(player.quickconnect_password, quickconnect_password):
authenticated = True
else:
authenticated = False
else: else:
authenticated = False if player.hostname == hostname and bcrypt.check_password_hash(player.password, password):
authenticated = True
else:
authenticated = False
else: else:
authenticated = False authenticated = False
@@ -400,7 +409,8 @@ def add_player():
username = request.form['username'] username = request.form['username']
hostname = request.form['hostname'] hostname = request.form['hostname']
password = bcrypt.generate_password_hash(request.form['password']).decode('utf-8') password = bcrypt.generate_password_hash(request.form['password']).decode('utf-8')
new_player = Player(username=username, hostname=hostname, password=password) quickconnect_password = bcrypt.generate_password_hash(request.form['quickconnect_password']).decode('utf-8')
new_player = Player(username=username, hostname=hostname, password=password, quickconnect_password=quickconnect_password)
db.session.add(new_player) db.session.add(new_player)
db.session.commit() db.session.commit()
return redirect(url_for('dashboard')) return redirect(url_for('dashboard'))

View File

@@ -2,6 +2,7 @@ version: '3.8'
services: services:
web: web:
image: digi-server:latest image: digi-server:latest
ports: ports:
- "7100:5000" - "7100:5000"
@@ -16,5 +17,5 @@ services:
- /home/ske087/digi-server/db:/app/instance - /home/ske087/digi-server/db:/app/instance
- /home/ske087/digi-server/static:/app/static/uploads - /home/ske087/digi-server/static:/app/static/uploads
# when setting allready exist and data are setted and is performed an update use second line of command # when setting allready exist and data are setted and is performed an update use second line of command
#command: sh -c "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app" command: sh -c "python clear_db.py && python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"
command: sh -c "python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app" #command: sh -c "python init_db.py && gunicorn -w 4 -b 0.0.0.0:5000 app:app"

Binary file not shown.

BIN
static/uploads/Ibex_450.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

View File

@@ -33,6 +33,10 @@
<label for="password" class="form-label">Password</label> <label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required> <input type="password" class="form-control" id="password" name="password" required>
</div> </div>
<div class="mb-3">
<label for="quickconnect_password" class="form-label">Quick Connect Password</label>
<input type="password" class="form-control" id="quickconnect_password" name="quickconnect_password" required>
</div>
<button type="submit" class="btn btn-primary">Add Player</button> <button type="submit" class="btn btn-primary">Add Player</button>
</form> </form>
<a href="{{ url_for('dashboard') }}" class="btn btn-secondary mt-3">Back to Dashboard</a> <a href="{{ url_for('dashboard') }}" class="btn btn-secondary mt-3">Back to Dashboard</a>

View File

@@ -29,6 +29,10 @@
<label for="password" class="form-label">Password</label> <label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" required> <input type="password" class="form-control" id="password" name="password" required>
</div> </div>
<div class="mb-3">
<label for="quickconnect_password" class="form-label">Quick Connect Password</label>
<input type="password" class="form-control" id="quickconnect_password" name="quickconnect_password">
</div>
<button type="submit" class="btn btn-primary">Authenticate</button> <button type="submit" class="btn btn-primary">Authenticate</button>
</form> </form>
</div> </div>