put max attribute for days

pull/139/head
Aevann 2023-03-12 16:48:19 +02:00
parent e5b21825aa
commit a5c93d199b
3 changed files with 8 additions and 5 deletions

View File

@ -110,6 +110,9 @@ def git_head():
gitref = 'Error'
return (gitref, head_txt)
def max_days():
return int((2147483647-time.time())/86400)
@app.context_processor
def inject_constants():
return {"environ":environ, "SITE":SITE, "SITE_NAME":SITE_NAME, "SITE_FULL":SITE_FULL,
@ -132,6 +135,6 @@ def inject_constants():
"PAGE_SIZES":PAGE_SIZES, "THEMES":THEMES, "COMMENT_SORTS":COMMENT_SORTS, "SORTS":SORTS,
"TIME_FILTERS":TIME_FILTERS, "HOUSES":HOUSES, "TIERS_ID_TO_NAME":TIERS_ID_TO_NAME,
"DEFAULT_CONFIG_VALUE":DEFAULT_CONFIG_VALUE, "IS_LOCALHOST":IS_LOCALHOST, "BACKGROUND_CATEGORIES":BACKGROUND_CATEGORIES, "PAGE_SIZE":PAGE_SIZE, "TAGLINES":TAGLINES, "IS_FISTMAS":IS_FISTMAS, "get_alt_graph":get_alt_graph, "current_registered_users":current_registered_users,
"git_head":git_head,
"git_head":git_head, "max_days":max_days,
"BIO_FRIENDS_ENEMIES_LENGTH_LIMIT":BIO_FRIENDS_ENEMIES_LENGTH_LIMIT,
}

View File

@ -18,7 +18,7 @@
<input autocomplete="off" name="reason" id="ban-modal-link" class="form-control" placeholder="Enter reason" maxlength="256">
<label for="days" class="mt-3">Days</label>
<input autocomplete="off" type="number" step="any" name="days" id="days" class="form-control" placeholder="Leave blank for permanent">
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" id="days" class="form-control" placeholder="Leave blank for permanent">
<div class="custom-control custom-switch mt-3">
<input autocomplete="off" type="checkbox" class="custom-control-input" id="alts" name="alts">
@ -51,7 +51,7 @@
<input hidden name="reason" id="chud-modal-link">
<label for="days">Days</label>
<input autocomplete="off" type="number" step="any" name="days" id="days" class="form-control" placeholder="Leave blank for permanent">
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" id="days" class="form-control" placeholder="Leave blank for permanent">
<div class="modal-footer pr-0">
<button type="button" class="btn btn-link text-muted" data-bs-dismiss="modal">Cancel</button>

View File

@ -47,7 +47,7 @@
<form class="my-3" action="/ban_user/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this, true)">
<input hidden name="formkey" value="{{v|formkey}}">
<input autocomplete="off" style="font-size:11px" type="text" class="form-control" maxlength="256" name="reason" placeholder="Ban Reason" data-nonce="{{g.nonce}}" data-undisable_element="user-ban-submit-{{deviceType}}" required>
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" placeholder="Days (blank = permanent)">
<input autocomplete="off" style="font-size:11px" type="number" step="any" class="form-control" name="days" max="{{max_days()}}" placeholder="Days (blank = permanent)">
<div class="custom-control custom-checkbox mb-1">
<input autocomplete="off" type="checkbox" id="alts-2-{{deviceType}}" class="custom-control-input" name="alts" value="1">
<label class="custom-control-label" for="alts-2-{{deviceType}}">Include alts</label>
@ -69,7 +69,7 @@
<form class="my-3" action="/agendaposter/{{u.id}}" method="post" data-nonce="{{g.nonce}}" data-onsubmit="sendFormXHRSwitch(this, true)">
<input hidden name="formkey" value="{{v|formkey}}">
<input autocomplete="off" type="number" step="any" name="days" class="form-control" placeholder="Days (0 or blank = permanent)">
<input autocomplete="off" type="number" step="any" name="days" max="{{max_days()}}" class="form-control" placeholder="Days (0 or blank = permanent)">
<input type="submit" class="btn btn-danger" value="Chud">
</form>
{% endif %}