forked from Hay1tsme/artemis
port frontend changes from different project
This commit is contained in:
@ -76,10 +76,12 @@ if not cfg.billing.standalone:
|
||||
Route("/request/", billing.handle_billing_request, methods=["POST"]),
|
||||
]
|
||||
|
||||
if not cfg.frontend.standalone:
|
||||
if not cfg.frontend.standalone and cfg.frontend.secret:
|
||||
frontend = FrontendServlet(cfg, cfg_dir)
|
||||
route_lst += frontend.get_routes()
|
||||
else:
|
||||
if not cfg.frontend.secret:
|
||||
logger.error("Frontend secret not specified, cannot start frontend!")
|
||||
route_lst.append(Route("/", dummy_rt))
|
||||
route_lst.append(Route("/robots.txt", FrontendServlet.robots))
|
||||
|
||||
|
@ -212,7 +212,7 @@ class FrontendConfig:
|
||||
|
||||
@property
|
||||
def secret(self) -> str:
|
||||
CoreConfig.get_config_field(
|
||||
return CoreConfig.get_config_field(
|
||||
self.__config, "core", "frontend", "secret", default=""
|
||||
)
|
||||
|
||||
|
@ -58,7 +58,7 @@ class CardData(BaseData):
|
||||
"""
|
||||
Given a 20 digit access code as a string, get the user id associated with that card
|
||||
"""
|
||||
card = self.get_card_by_access_code(access_code)
|
||||
card = await self.get_card_by_access_code(access_code)
|
||||
if card is None:
|
||||
return None
|
||||
|
||||
@ -68,7 +68,7 @@ class CardData(BaseData):
|
||||
"""
|
||||
Given a 20 digit access code as a string, check if the card is banned
|
||||
"""
|
||||
card = self.get_card_by_access_code(access_code)
|
||||
card = await self.get_card_by_access_code(access_code)
|
||||
if card is None:
|
||||
return None
|
||||
if card["is_banned"]:
|
||||
@ -78,7 +78,7 @@ class CardData(BaseData):
|
||||
"""
|
||||
Given a 20 digit access code as a string, check if the card is locked
|
||||
"""
|
||||
card = self.get_card_by_access_code(access_code)
|
||||
card = await self.get_card_by_access_code(access_code)
|
||||
if card is None:
|
||||
return None
|
||||
if card["is_locked"]:
|
||||
|
@ -64,8 +64,8 @@ class UserData(BaseData):
|
||||
return False
|
||||
return result.fetchone()
|
||||
|
||||
def check_password(self, user_id: int, passwd: bytes = None) -> bool:
|
||||
usr = self.get_user(user_id)
|
||||
async def check_password(self, user_id: int, passwd: bytes = None) -> bool:
|
||||
usr = await self.get_user(user_id)
|
||||
if usr is None:
|
||||
return False
|
||||
|
||||
|
866
core/frontend.py
866
core/frontend.py
File diff suppressed because it is too large
Load Diff
@ -1,4 +0,0 @@
|
||||
{% extends "core/frontend/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>{{ arcade.name }}</h1>
|
||||
{% endblock content %}
|
@ -1,5 +0,0 @@
|
||||
{% extends "core/frontend/index.jinja" %}
|
||||
{% block content %}
|
||||
{% include "core/frontend/widgets/err_banner.jinja" %}
|
||||
<h1>Machine Management</h1>
|
||||
{% endblock content %}
|
@ -1,103 +0,0 @@
|
||||
{% extends "core/frontend/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>System Management</h1>
|
||||
|
||||
<div class="row" id="rowForm">
|
||||
{% if sesh.permissions >= 2 %}
|
||||
<div class="col-sm-6" style="max-width: 25%;">
|
||||
<form id="usrLookup" name="usrLookup" action="/sys/lookup.user" class="form-inline">
|
||||
<h3>User Search</h3>
|
||||
<div class="form-group">
|
||||
<label for="usrId">User ID</label>
|
||||
<input type="number" class="form-control" id="usrId" name="usrId">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="usrName">Username</label>
|
||||
<input type="text" class="form-control" id="usrName" name="usrName">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="usrEmail">Email address</label>
|
||||
<input type="email" class="form-control" id="usrEmail" name="usrEmail" aria-describedby="emailHelp">
|
||||
</div>
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if sesh.permissions >= 4 %}
|
||||
<div class="col-sm-6" style="max-width: 25%;">
|
||||
<form id="arcadeLookup" name="arcadeLookup" action="/sys/lookup.arcade" class="form-inline" >
|
||||
<h3>Arcade Search</h3>
|
||||
<div class="form-group">
|
||||
<label for="arcadeId">Arcade ID</label>
|
||||
<input type="number" class="form-control" id="arcadeId" name="arcadeId">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="arcadeName">Arcade Name</label>
|
||||
<input type="text" class="form-control" id="arcadeName" name="arcadeName">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="arcadeUser">Owner User ID</label>
|
||||
<input type="number" class="form-control" id="arcadeUser" name="arcadeUser">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="arcadeIp">Assigned IP Address</label>
|
||||
<input type="text" class="form-control" id="arcadeIp" name="arcadeIp">
|
||||
</div>
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="col-sm-6" style="max-width: 25%;">
|
||||
<form id="cabLookup" name="cabLookup" action="/sys/lookup.cab" class="form-inline" >
|
||||
<h3>Machine Search</h3>
|
||||
<div class="form-group">
|
||||
<label for="cabId">Machine ID</label>
|
||||
<input type="number" class="form-control" id="cabId" name="cabId">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="cabSerial">Machine Serial</label>
|
||||
<input type="text" class="form-control" id="cabSerial" name="cabSerial">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="cabAcId">Arcade ID</label>
|
||||
<input type="number" class="form-control" id="cabAcId" name="cabAcId">
|
||||
</div>
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row" id="rowResult" style="margin: 10px;">
|
||||
{% if sesh.permissions >= 2 %}
|
||||
<div id="userSearchResult" class="col-sm-6" style="max-width: 25%;">
|
||||
{% for usr in usrlist %}
|
||||
<a href=/user/{{ usr.id }}><pre>{{ usr.id }} | {{ usr.username if usr.username != None else "<i>No Name Set</i>"}}</pre></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if sesh.permissions >= 4 %}
|
||||
<div id="arcadeSearchResult" class="col-sm-6" style="max-width: 25%;">
|
||||
{% for ac in aclist %}
|
||||
<pre><a href=/arcade/{{ ac.id }}>{{ ac.id }} | {{ ac.name if ac.name != None else "<i>No Name Set</i>" }} | {{ ac.ip if ac.ip != None else "<i>No IP Assigned</i>"}}</pre></a>
|
||||
{% endfor %}
|
||||
</div
|
||||
><div id="cabSearchResult" class="col-sm-6" style="max-width: 25%;">
|
||||
{% for cab in cablist %}
|
||||
<a href=/cab/{{ cab.id }}><pre>{{ cab.id }} | {{ cab.game if cab.game != None else "<i>ANY </i>" }} | {{ cab.serial }}</pre></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row" id="rowAdd">
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
@ -1,41 +0,0 @@
|
||||
{% extends "core/frontend/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>Management for {{ username }}</h1>
|
||||
<h2>Cards <button class="btn btn-success" data-bs-toggle="modal" data-bs-target="#card_add">Add</button></h2>
|
||||
<ul style="font-size: 20px;">
|
||||
{% for c in cards %}
|
||||
<li>{{ c.access_code }}: {{ c.status }} {% if c.status == 'Active'%}<button class="btn-warning btn">Lock</button>{% elif c.status == 'Locked' %}<button class="btn-warning btn">Unlock</button>{% endif %} <button class="btn-danger btn">Delete</button></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% if arcades is defined %}
|
||||
<h2>Arcades</h2>
|
||||
<ul style="font-size: 20px;">
|
||||
{% for a in arcades %}
|
||||
<li><a href=/arcade/{{ a.id }}>{{ a.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<div class="modal fade" id="card_add" tabindex="-1" aria-labelledby="card_add_label" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="card_add_label">Add Card</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
HOW TO:<br>
|
||||
Scan your card on any networked game and press the "View Access Code" button (varies by game) and enter the 20 digit code below.<br>
|
||||
!!FOR AMUSEIC CARDS: DO NOT ENTER THE CODE SHOWN ON THE BACK OF THE CARD ITSELF OR IT WILL NOT WORK!!
|
||||
<p /><label for="card_add_frm_access_code">Access Code: </label><input id="card_add_frm_access_code" maxlength="20" type="text" required>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-primary">Add</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
@ -1,18 +0,0 @@
|
||||
{% if error > 0 %}
|
||||
<div class="err-banner">
|
||||
<h3>Error</h3>
|
||||
{% if error == 1 %}
|
||||
Card not registered, or wrong password
|
||||
{% elif error == 2 %}
|
||||
Missing or malformed access code
|
||||
{% elif error == 3 %}
|
||||
Failed to create user
|
||||
{% elif error == 4 %}
|
||||
Arcade not found
|
||||
{% elif error == 5 %}
|
||||
Machine not found
|
||||
{% else %}
|
||||
An unknown error occoured
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
4
core/templates/arcade/index.jinja
Normal file
4
core/templates/arcade/index.jinja
Normal file
@ -0,0 +1,4 @@
|
||||
{% extends "core/templates/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>{{ arcade.name }}</h1>
|
||||
{% endblock content %}
|
@ -1,4 +1,4 @@
|
||||
{% extends "core/frontend/index.jinja" %}
|
||||
{% extends "core/templates/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>Create User</h1>
|
||||
<form id="create" style="max-width: 240px; min-width: 10%;" action="/gate/gate.create" method="post">
|
@ -1,7 +1,7 @@
|
||||
{% extends "core/frontend/index.jinja" %}
|
||||
{% extends "core/templates/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>Gate</h1>
|
||||
{% include "core/frontend/widgets/err_banner.jinja" %}
|
||||
{% include "core/templates/widgets/err_banner.jinja" %}
|
||||
<style>
|
||||
/* Chrome, Safari, Edge, Opera */
|
||||
input::-webkit-outer-spin-button,
|
@ -84,7 +84,7 @@
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
{% include "core/frontend/widgets/topbar.jinja" %}
|
||||
{% include "core/templates/widgets/topbar.jinja" %}
|
||||
{% block content %}
|
||||
<h1>{{ server_name }}</h1>
|
||||
{% endblock content %}
|
5
core/templates/machine/index.jinja
Normal file
5
core/templates/machine/index.jinja
Normal file
@ -0,0 +1,5 @@
|
||||
{% extends "core/templates/index.jinja" %}
|
||||
{% block content %}
|
||||
{% include "core/templates/widgets/err_banner.jinja" %}
|
||||
<h1>Machine Management</h1>
|
||||
{% endblock content %}
|
69
core/templates/sys/index.jinja
Normal file
69
core/templates/sys/index.jinja
Normal file
@ -0,0 +1,69 @@
|
||||
{% extends "core/templates/index.jinja" %}
|
||||
{% block content %}
|
||||
<h1>System Management</h1>
|
||||
{% if error is defined %}
|
||||
{% include "core/templates/widgets/err_banner.jinja" %}
|
||||
{% endif %}
|
||||
<div class="row" id="rowForm">
|
||||
{% if "{:08b}".format(sesh.permissions)[6] == "1" %}
|
||||
<div class="col-sm-6" style="max-width: 25%;">
|
||||
<form id="usrLookup" name="usrLookup" action="/sys/lookup.user" class="form-inline">
|
||||
<h3>User Search</h3>
|
||||
<div class="form-group">
|
||||
<label for="usrId">User ID</label>
|
||||
<input type="number" class="form-control" id="usrId" name="usrId">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="usrName">Username</label>
|
||||
<input type="text" class="form-control" id="usrName" name="usrName">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="usrEmail">Email address</label>
|
||||
<input type="email" class="form-control" id="usrEmail" name="usrEmail" aria-describedby="emailHelp">
|
||||
</div>
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if "{:08b}".format(sesh.permissions)[5] == "1" %}
|
||||
<div class="col-sm-6" style="max-width: 25%;">
|
||||
<form id="shopLookup" name="shopLookup" action="/sys/lookup.shop" class="form-inline">
|
||||
<h3>Shop search</h3>
|
||||
<div class="form-group">
|
||||
<label for="shopId">Shop ID</label>
|
||||
<input type="number" class="form-control" id="shopId" name="shopId">
|
||||
</div>
|
||||
OR
|
||||
<div class="form-group">
|
||||
<label for="serialNum">Serial Number</label>
|
||||
<input type="text" class="form-control" id="serialNum" name="serialNum" maxlength="12">
|
||||
</div>
|
||||
<br />
|
||||
<button type="submit" class="btn btn-primary">Search</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row" id="rowResult" style="margin: 10px;">
|
||||
{% if "{:08b}".format(sesh.permissions)[6] == "1" %}
|
||||
<div id="userSearchResult" class="col-sm-6" style="max-width: 25%;">
|
||||
{% for usr in usrlist %}
|
||||
<a href=/user/{{ usr.id }}><pre>{{ usr.username if usr.username is not none else "<i>No Name Set</i>"}}</pre></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if "{:08b}".format(sesh.permissions)[5] == "1" %}
|
||||
<div id="shopSearchResult" class="col-sm-6" style="max-width: 25%;">
|
||||
{% for shop in shoplist %}
|
||||
<a href="/shop/{{ shop.id }}"><pre>{{ shop.name if shop.name else "<i>No Name Set</i>"}}</pre></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row" id="rowAdd">
|
||||
|
||||
</div>
|
||||
{% endblock content %}
|
175
core/templates/user/index.jinja
Normal file
175
core/templates/user/index.jinja
Normal file
@ -0,0 +1,175 @@
|
||||
{% extends "core/templates/index.jinja" %}
|
||||
{% block content %}
|
||||
<script type="text/javascript">
|
||||
function toggle_new_name_form() {
|
||||
let frm = document.getElementById("new_name_form");
|
||||
let btn = document.getElementById("btn_toggle_form");
|
||||
|
||||
if (frm.style['display'] != "") {
|
||||
frm.style['display'] = "";
|
||||
frm.style['max-height'] = "";
|
||||
btn.innerText = "Cancel";
|
||||
} else {
|
||||
frm.style['display'] = "none";
|
||||
frm.style['max-height'] = "0px";
|
||||
btn.innerText = "Edit";
|
||||
}
|
||||
}
|
||||
function toggle_add_card_form() {
|
||||
let btn = document.getElementById("btn_add_card");
|
||||
let dv = document.getElementById("add_card_container")
|
||||
|
||||
if (dv.style['display'] != "") {
|
||||
btn.innerText = "Cancel";
|
||||
dv.style['display'] = "";
|
||||
} else {
|
||||
btn.innerText = "Add";
|
||||
dv.style['display'] = "none";
|
||||
}
|
||||
}
|
||||
|
||||
function prep_edit_form(access_code, chip_id, idm, card_type, u_memo) {
|
||||
ac = document.getElementById("card_edit_frm_access_code");
|
||||
cid = document.getElementById("card_edit_frm_chip_id");
|
||||
fidm = document.getElementById("card_edit_frm_idm");
|
||||
memo = document.getElementById("card_edit_frm_memo");
|
||||
|
||||
if (chip_id == "None" || chip_id == undefined) {
|
||||
chip_id = ""
|
||||
}
|
||||
if (idm == "None" || idm == undefined) {
|
||||
idm = ""
|
||||
}
|
||||
if (u_memo == "None" || u_memo == undefined) {
|
||||
u_memo = ""
|
||||
}
|
||||
|
||||
ac.value = access_code;
|
||||
cid.value = chip_id;
|
||||
fidm.value = idm;
|
||||
memo.value = u_memo;
|
||||
|
||||
if (card_type == "AmusementIC") {
|
||||
cid.disabled = true;
|
||||
fidm.disabled = false;
|
||||
} else {
|
||||
cid.disabled = false;
|
||||
fidm.disabled = true;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<h1>Management for {{ username }} <button onclick="toggle_new_name_form()" class="btn btn-secondary" id="btn_toggle_form">Edit</button></h1>
|
||||
{% if error is defined %}
|
||||
{% include "core/templates/widgets/err_banner.jinja" %}
|
||||
{% endif %}
|
||||
{% if success is defined and success == 2 %}
|
||||
<div style="background-color: #00AA00; padding: 20px; margin-bottom: 10px; width: 15%;">
|
||||
Update successful
|
||||
</div>
|
||||
{% endif %}
|
||||
<form style="max-width: 33%; display: none; max-height: 0px;" action="/user/update.name" method="post" id="new_name_form">
|
||||
<div class="mb-3">
|
||||
<label for="new_name" class="form-label">New Nickname</label>
|
||||
<input type="text" class="form-control" id="new_name" name="new_name" aria-describedby="new_name_help">
|
||||
<div id="new_name_help" class="form-text">Must be 10 characters or less</div>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
<p></p>
|
||||
<h2>Cards <button class="btn btn-success" id="btn_add_card" onclick="toggle_add_card_form()">Add</button></h2>
|
||||
{% if success is defined and success == 3 %}
|
||||
<div style="background-color: #00AA00; padding: 20px; margin-bottom: 10px; width: 15%;">
|
||||
Card added successfully
|
||||
</div>
|
||||
{% endif %}
|
||||
<div id="add_card_container" style="display: none; max-width: 33%;">
|
||||
<form action="/user/add.card" method="post", id="frm_add_card">
|
||||
<label class="form-label" for="card_add_frm_access_code">Access Code:</label>
|
||||
<input class="form-control" name="add_access_code" id="card_add_frm_access_code" maxlength="20" type="text" required aria-describedby="ac_help">
|
||||
<div id="ac_help" class="form-text">20 digit code on the back of the card.</div>
|
||||
<button type="submit" class="btn btn-primary">Add</button>
|
||||
</form>
|
||||
<br>
|
||||
</div>
|
||||
<ul style="font-size: 20px;">
|
||||
{% for c in cards %}
|
||||
<li>{{ c.access_code }} ({{ c.type}}): {{ c.status }} <button onclick="prep_edit_form('{{ c.access_code }}', '{{ c.chip_id}}', '{{ c.idm }}', '{{ c.type }}', '{{ c.memo }}')" data-bs-toggle="modal" data-bs-target="#card_edit" class="btn btn-secondary" id="btn_edit_card_{{ c.access_code }}">Edit</button> {% if c.status == 'Active'%}<button class="btn-warning btn">Lock</button>{% elif c.status == 'Locked' %}<button class="btn-warning btn">Unlock</button>{% endif %} <button class="btn-danger btn">Delete</button></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h2>Reset Password</h2>
|
||||
{% if success is defined and success == 1 %}
|
||||
<div style="background-color: #00AA00; padding: 20px; margin-bottom: 10px; width: 15%;">
|
||||
Update successful
|
||||
</div>
|
||||
{% endif %}
|
||||
<form style="max-width: 33%;" action="/user/update.pw" method="post">
|
||||
<div class="mb-3">
|
||||
<label for="current_pw" class="form-label">Current Password</label>
|
||||
<input type="password" class="form-control" id="current_pw" name="current_pw">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password1" class="form-label">New Password</label>
|
||||
<input type="password" class="form-control" id="password1" name="password1" aria-describedby="password_help">
|
||||
<div id="password_help" class="form-text">Password must be at least 10 characters long, contain an upper and lowercase character, number, and special character</div>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password2" class="form-label">Retype New Password</label>
|
||||
<input type="password" class="form-control" id="password2" name="password2">
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
</form>
|
||||
|
||||
{% if arcades is defined and arcades|length > 0 %}
|
||||
<h2>Arcades</h2>
|
||||
<ul>
|
||||
{% for a in arcades %}
|
||||
<li><h3>{{ a.name }}</h3>
|
||||
{% if a.machines|length > 0 %}
|
||||
<table>
|
||||
<tr><th>Serial</th><th>Game</th><th>Last Seen</th></tr>
|
||||
{% for m in a.machines %}
|
||||
<tr><td>{{ m.serial }}</td><td>{{ m.game }}</td><td>{{ m.last_seen }}</td></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
<div class="modal fade" id="card_edit" tabindex="-1" aria-labelledby="card_edit_label" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h1 class="modal-title fs-5" id="card_edit_label">Edit Card</h1>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form action="/user/edit.card" method="post", id="frm_edit_card">
|
||||
<label class="form-label" for="card_edit_frm_access_code">Access Code:</label>
|
||||
<input class="form-control" readonly name="add_access_code" id="card_edit_frm_access_code" maxlength="20" type="text" required aria-describedby="ac_help">
|
||||
<div id="ac_help" class="form-text">20 digit code on the back of the card. If this is incorrect, contact a sysadmin.</div>
|
||||
|
||||
<label class="form-label" for="card_edit_frm_memo" id="card_edit_frm_memo_lbl">Memo:</label>
|
||||
<input class="form-control" aria-describedby="memo_help" name="add_memo" id="card_edit_frm_memo" maxlength="16" type="text">
|
||||
<div id="memo_help" class="form-text">Must be 16 characters or less.</div>
|
||||
|
||||
<label class="form-label" for="card_edit_frm_idm" id="card_edit_frm_idm_lbl">FeliCa IDm:</label>
|
||||
<input class="form-control" aria-describedby="idm_help" name="add_felica_idm" id="card_edit_frm_idm" maxlength="16" type="text">
|
||||
<div id="idm_help" class="form-text">8 bytes that uniquly idenfites a FeliCa card. Obtained by reading the card with an NFC reader.</div>
|
||||
|
||||
<label class="form-label" for="card_edit_frm_chip_id" id="card_edit_frm_chip_id_lbl">Mifare UID:</label>
|
||||
<input class="form-control" aria-describedby="chip_id_help" name="add_mifare_chip_id" id="card_edit_frm_chip_id" maxlength="8" type="text">
|
||||
<div id="chip_id_help" class="form-text">4 byte integer that uniquly identifies a Mifare card. Obtained by reading the card with an NFC reader.</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="submit" class="btn btn-primary" form="frm_edit_card">Edit</button>
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% endblock content %}
|
29
core/templates/widgets/err_banner.jinja
Normal file
29
core/templates/widgets/err_banner.jinja
Normal file
@ -0,0 +1,29 @@
|
||||
{% if error > 0 %}
|
||||
<div class="err-banner">
|
||||
<h3>Error</h3>
|
||||
{% if error == 1 %}
|
||||
Card not registered, or wrong password
|
||||
{% elif error == 2 %}
|
||||
Missing or malformed access code
|
||||
{% elif error == 3 %}
|
||||
Failed to create user
|
||||
{% elif error == 4 %}
|
||||
Required field not filled or invalid
|
||||
{% elif error == 5 %}
|
||||
Incorrect old password
|
||||
{% elif error == 6 %}
|
||||
Passwords don't match
|
||||
{% elif error == 7 %}
|
||||
New password not acceptable
|
||||
{% elif error == 8 %}
|
||||
New Nickname too long
|
||||
{% elif error == 9 %}
|
||||
You must be logged in to preform this action
|
||||
New Nickname too long
|
||||
{% elif error == 10 %}
|
||||
Invalid serial number
|
||||
{% else %}
|
||||
An unknown error occoured
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
@ -3,19 +3,20 @@
|
||||
</div>
|
||||
<div style="background: #333; color: #f9f9f9; width: 80%; height: 50px; line-height: 50px; padding-left: 10px; float: left;">
|
||||
<a href=/><button class="btn btn-primary">Home</button></a>
|
||||
{% for game in game_list %}
|
||||
<a href=/game/{{ game.url }}><button class="btn btn-success">{{ game.name }}</button></a>
|
||||
{% for game, data in game_list|items %}
|
||||
<a href=/game{{ data.url }}/><button class="btn btn-success">{{ game }}</button></a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
<div style="background: #333; color: #f9f9f9; width: 10%; height: 50px; line-height: 50px; text-align: center; float: left;">
|
||||
{% if sesh is defined and sesh["permissions"] >= 2 %}
|
||||
<a href="/sys"><button class="btn btn-primary">System</button></a>
|
||||
<a href="/sys/"><button class="btn btn-primary">System</button></a>
|
||||
{% endif %}
|
||||
{% if sesh is defined and sesh["userId"] > 0 %}
|
||||
<a href="/user"><button class="btn btn-primary">Account</button></a>
|
||||
{% if sesh is defined and sesh["user_id"] > 0 %}
|
||||
<a href="/user/"><button class="btn btn-primary">Account</button></a>
|
||||
<a href="/user/logout"><button class="btn btn-danger">Logout</button></a>
|
||||
{% else %}
|
||||
<a href="/gate"><button class="btn btn-primary">Gate</button></a>
|
||||
<a href="/gate/"><button class="btn btn-primary">Gate</button></a>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user