update theme
This commit is contained in:
parent
5915463b71
commit
a60e1b2cac
@ -57,9 +57,9 @@ def convert_nato(string):
|
||||
'M': 'MIKE', 'N': 'NOVEMBER','O': 'OSCAR', 'P': 'PAPA',
|
||||
'Q': 'QUEBEC', 'R': 'ROMEO', 'S': 'SIERRA', 'T': 'TANGO',
|
||||
'U': 'UNIFORM', 'V': 'VICTOR', 'W': 'WHISKEY', 'X': 'X-RAY',
|
||||
'Y': 'YANKEE', 'Z': 'ZULU', '0': 'zero', '1': 'one',
|
||||
'2': 'two', '3': 'three', '4': 'four', '5': 'five',
|
||||
'6': 'six', '7': 'seven', '8': 'eight', '9': 'nine',
|
||||
'Y': 'YANKEE', 'Z': 'ZULU', '0': 'zero(0)', '1': 'one(1)',
|
||||
'2': 'two(2)', '3': 'three(3)', '4': 'four(4)', '5': 'five(5)',
|
||||
'6': 'six(6)', '7': 'seven(7)', '8': 'eight(8)', '9': 'nine(9)',
|
||||
'a': 'alpha', 'b': 'bravo', 'c': 'charlie', 'd': 'delta',
|
||||
'e': 'echo', 'f': 'foxtrot', 'g': 'golf', 'h': 'hotel',
|
||||
'i': 'india', 'j': 'juliett','k': 'kilo', 'l': 'lima',
|
||||
@ -207,7 +207,7 @@ def create_app():
|
||||
## <p><a href={{ url_for('user.logout') }}>Sign out</a></p>
|
||||
## {% endblock %}
|
||||
## """)
|
||||
return render_template('index.html', markup_content = content, logo = logo)
|
||||
return render_template('index.html', markup_content = content)
|
||||
|
||||
@app.route('/generate_passphrase/pi-star', methods = ['GET'])
|
||||
@login_required
|
||||
@ -257,7 +257,7 @@ def create_app():
|
||||
|
||||
|
||||
#return str(content)
|
||||
return render_template('flask_user_layout.html', markup_content = Markup(content), logo = logo)
|
||||
return render_template('flask_user_layout.html', markup_content = Markup(content))
|
||||
|
||||
|
||||
|
||||
@ -280,7 +280,7 @@ def create_app():
|
||||
if i[1] == '':
|
||||
link_num = str(random.randint(1,99999999)).zfill(8) + str(time.time()) + str(random.randint(1,99999999)).zfill(8)
|
||||
script_links[i[0]] = link_num
|
||||
print(script_links)
|
||||
#print(script_links)
|
||||
content = content + '''\n
|
||||
<table style="width: 300px;" border="1">
|
||||
<tbody>
|
||||
@ -335,7 +335,7 @@ def create_app():
|
||||
|
||||
|
||||
#return str(content)
|
||||
return render_template('view_passphrase.html', markup_content = Markup(content), logo = logo)
|
||||
return render_template('view_passphrase.html', markup_content = Markup(content))
|
||||
|
||||
# The Members page is only accessible to authenticated users via the @login_required decorator
|
||||
@app.route('/members')
|
||||
@ -354,7 +354,7 @@ def create_app():
|
||||
## {% endblock %}
|
||||
## """)
|
||||
content = 'Mem only'
|
||||
return render_template('flask_user_layout.html', markup_content = content, logo = logo)
|
||||
return render_template('flask_user_layout.html', markup_content = content)
|
||||
|
||||
|
||||
# The Admin page requires an 'Admin' role.
|
||||
@ -479,7 +479,7 @@ def create_app():
|
||||
## {% endblock %}
|
||||
## """)
|
||||
|
||||
return render_template('flask_user_layout.html', markup_content = Markup(content), logo = logo)
|
||||
return render_template('flask_user_layout.html', markup_content = Markup(content))
|
||||
|
||||
@app.route('/get_script')
|
||||
def get_script():
|
||||
@ -599,7 +599,7 @@ def create_app():
|
||||
else:
|
||||
content = 'Created user ' + str(request.form.get('Error'))
|
||||
|
||||
return render_template('flask_user_layout.html', markup_content = Markup(content), logo = logo)
|
||||
return render_template('flask_user_layout.html', markup_content = Markup(content))
|
||||
|
||||
@app.route('/auth', methods=['POST'])
|
||||
def auth():
|
||||
|
@ -1,123 +0,0 @@
|
||||
from flask import Flask, render_template, request, Response, Markup, jsonify, make_response
|
||||
from config import *
|
||||
import base64, hashlib
|
||||
from dmr_utils3.utils import int_id, bytes_4
|
||||
|
||||
auth_dict = {}
|
||||
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
def gen_passphrase(dmr_id):
|
||||
_new_peer_id = bytes_4(int(str(dmr_id)[:7]))
|
||||
calc_passphrase = base64.b64encode((_new_peer_id) + append_int.to_bytes(2, 'big'))
|
||||
return str(calc_passphrase)[2:-1]
|
||||
|
||||
|
||||
@app.route('/gen', methods = ['POST', 'GET'])
|
||||
def gen():
|
||||
#content = Markup('<strong>The HTML String</strong>')
|
||||
user_id = request.args.get('user_id')
|
||||
print(user_id)
|
||||
print(request.args.get('mode'))
|
||||
if request.args.get('mode') == 'generated':
|
||||
auth_dict.update({int(user_id):''})
|
||||
content = '''
|
||||
<p style="text-align: center;">Your passphrase for <strong>''' + str(user_id) + '''</strong>:</p>
|
||||
<p style="text-align: center;"><strong>''' + str(gen_passphrase(int(user_id))) + '''</strong></p>
|
||||
'''
|
||||
if request.args.get('mode') == 'legacy':
|
||||
auth_dict.update({int(user_id):0})
|
||||
content = '''<p style="text-align: center;">Using legacy auth</p>'''
|
||||
if request.args.get('mode') == 'custom':
|
||||
auth_dict.update({int(user_id):str(request.args.get('custom'))})
|
||||
content = '''<p style="text-align: center;">Using custom auth passphrase: ''' + request.args.get('custom') + '''</p>'''
|
||||
|
||||
print(auth_dict)
|
||||
|
||||
|
||||
return render_template('generic.html', title = title, url = url, logo = logo, content = Markup(content))
|
||||
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
#content = Markup('<strong>The HTML String</strong>')
|
||||
content = '''
|
||||
<table style="width: 600px; margin-left: auto; margin-right: auto;" border="3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><form action="gen" method="get">
|
||||
<table style="margin-left: auto; margin-right: auto;">
|
||||
<tbody>
|
||||
<tr style="height: 62px;">
|
||||
<td style="text-align: center; height: 62px;">
|
||||
<h2><strong><label for="user_id">DMR ID</label></strong></h2>
|
||||
</td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px; text-align: center;"><input id="user_id" name="user_id" type="text" /></td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px; text-align: center;"><select name="mode">
|
||||
<option selected="selected" value="generated">Generated Passphrase</option>
|
||||
<option value="legacy">Legacy</option>
|
||||
<option value="custom">Custom</option>
|
||||
</select></td>
|
||||
</tr>
|
||||
<tr style="height: 51.1667px;">
|
||||
<td style="height: 51.1667px;">Custom Password (only use if custom is selected): <input id="custom" name="custom" type="text" /></td>
|
||||
</tr>
|
||||
<tr style="height: 27px;">
|
||||
<td style="text-align: center; height: 27px;"><input type="submit" value="Submit" /></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p> </p>
|
||||
'''
|
||||
|
||||
|
||||
return render_template('generic.html', title = title, url = url, logo = logo, content = Markup(content))
|
||||
|
||||
@app.route('/auth', methods=['POST'])
|
||||
def auth():
|
||||
hblink_req = request.json
|
||||
print((hblink_req))
|
||||
print(auth_dict)
|
||||
if hblink_req['secret'] in shared_secrets:
|
||||
if hblink_req['id'] in auth_dict:
|
||||
if auth_dict[hblink_req['id']] == 0:
|
||||
response = jsonify(
|
||||
allow=True,
|
||||
mode='legacy',
|
||||
)
|
||||
elif auth_dict[hblink_req['id']] == '':
|
||||
# normal
|
||||
response = jsonify(
|
||||
allow=True,
|
||||
mode='normal',
|
||||
)
|
||||
elif auth_dict[hblink_req['id']] != '' or auth_dict[hblink_req['id']] != 0:
|
||||
response = jsonify(
|
||||
allow=True,
|
||||
mode='override',
|
||||
value=auth_dict[hblink_req['id']]
|
||||
)
|
||||
if hblink_req['id'] not in auth_dict:
|
||||
response = jsonify(
|
||||
allow=False)
|
||||
else:
|
||||
message = jsonify(message='Authentication error')
|
||||
response = make_response(message, 401)
|
||||
|
||||
return response
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
app.run(debug = True, port=ums_port, host=ums_host)
|
@ -13,8 +13,6 @@ use_short_passphrase = False
|
||||
|
||||
# Title of the Dashboard
|
||||
title = 'MMDVM User Portal'
|
||||
# Logo used on dashboard page
|
||||
logo = 'https://github.com/HBLink-org/hblink3/raw/master/HBlink.png'
|
||||
# Port to run server
|
||||
ums_port = 8080
|
||||
# IP to run server on
|
||||
|
BIN
user_managment/static/HBlink.png
Normal file
BIN
user_managment/static/HBlink.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 42 KiB |
@ -31,7 +31,7 @@
|
||||
|
||||
<body>
|
||||
<h1 style="text-align: center;">{{ user_manager.USER_APP_NAME }}</h1>
|
||||
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="{{logo}}" alt="Logo" width="300" height="144" /></p>
|
||||
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="{{ url_for('static', filename='HBlink.png') }}" alt="Logo" width="300" height="144" /></p>
|
||||
<h1 style="text-align: center;">{{title}}</h1>
|
||||
<hr />
|
||||
<table style="width: 500px; margin-left: auto; margin-right: auto;" border="black" cellspacing="3" cellpadding="3">
|
||||
|
@ -1,5 +0,0 @@
|
||||
<div>
|
||||
<hr />
|
||||
<div style="text-align: center;">{{title}} created by KF7EEL, W7NCX, and N9VW.<br />pnwdigital.net<br />
|
||||
</body>
|
||||
</html>
|
@ -1,5 +0,0 @@
|
||||
{% include 'page.html' %}
|
||||
{% include 'header.html' %}
|
||||
{{content}}
|
||||
{% include 'footer.html' %}
|
||||
|
@ -1,11 +0,0 @@
|
||||
<p><img style="display: block; margin-left: auto; margin-right: auto;" src="{{logo}}" alt="Logo" width="300" height="144" /></p>
|
||||
<h1 style="text-align: center;">{{title}}</h1>
|
||||
<hr />
|
||||
<table style="width: 500px; margin-left: auto; margin-right: auto;" border="black" cellspacing="3" cellpadding="3">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="text-align: center;"><button onclick="window.location.href='{{url}}/';"> Home </button></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
@ -1,22 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>{{title}}</title>
|
||||
<style>
|
||||
body {background-color: D3D3D3;}
|
||||
h1 {color: green;}
|
||||
p {
|
||||
padding: 10px;
|
||||
margin: 20px;
|
||||
|
||||
}
|
||||
.content {
|
||||
max-width: 1200px;
|
||||
min-width: 1200px;
|
||||
margin: auto;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<div class="content">
|
||||
<body>
|
Loading…
Reference in New Issue
Block a user