continued hidden refactor

This commit is contained in:
Xevion
2019-10-03 22:18:47 -05:00
parent 2c2439d140
commit 56ecaedd59
3 changed files with 17 additions and 7 deletions

View File

@@ -16,5 +16,5 @@ db = SQLAlchemy(app)
migrate = Migrate(app, db)
from app import models
from app import routes, simple_routes, hidden, dashboard, custom
from app import routes, simple_routes, hidden, dashboard, ftbhot, custom
app.jinja_env.globals.update(get_hidden=routes.get_hidden)

View File

@@ -1,6 +1,22 @@
from app import app, db, login
from app.custom import require_role
from flask_login import current_user, login_user, logout_user, login_required
from flask import request
# The only implementation I could get to work
def validate_id(id):
id = str(id).strip()
val = str(app.config['HIDDEN_NUMBER']).strip()
return id == val
# Parses strings to test for "boolean-ness"
def boolparse(string, default=False):
trues = ['true', '1']
if string is None:
return default
elif string.lower() in trues:
return True
return False
@app.route('/hidden<id>/')
@login_required

View File

@@ -171,12 +171,6 @@ def logout():
logout_user()
return redirect(url_for('index'))
# The only implementation I could get to work
def validate_id(id):
id = str(id).strip()
val = str(app.config['HIDDEN_NUMBER']).strip()
return id == val
def get_hidden():
return "/hidden{}/".format(app.config['HIDDEN_NUMBER'])