Added support for propic expiration

This commit is contained in:
Ed 2023-05-08 22:08:44 +02:00
parent 1a77952dbc
commit 75fd737baa
2 changed files with 6 additions and 2 deletions

View File

@ -2,12 +2,13 @@ from sanic.response import html, redirect, text
from sanic import Blueprint, exceptions
from random import choice
from ext import *
from config import headers
from config import headers, PROPIC_DEADLINE
from PIL import Image
from os.path import isfile
from os import unlink
from io import BytesIO
from hashlib import sha224
from time import time
bp = Blueprint("propic", url_prefix="/manage/propic")
@ -18,6 +19,9 @@ async def upload_propic(request, order: Order):
if order.propic_locked:
raise exceptions.BadRequest("You have been limited from further editing the propic.")
if time() > PROPIC_DEADLINE:
raise exceptions.BadRequest("You are beyond the file upload deadline. No more changes are allowed.")
if request.form.get('submit') == 'Delete main image':
await order.edit_answer('propic', None)

View File

@ -35,7 +35,7 @@
</div>
{% if time() > PROPIC_DEADLINE %}
<p class="notice">⚠️ The deadline to upload pictures for the badge has expired. For last-minute changes, please contact the support over at <a href="mailto:info@furizon.net">info@furizon.net</a>. If your badge has been printed already, changing it will incur in a 2€ fee.</p>
<p class="notice">⚠️ The deadline to upload pictures for the badge has expired. For last-minute changes, please contact the support over at <a href="mailto:info@furizon.net">info@furizon.net</a>. If your badge has been printed already, changing it will incur in a 2€ fee. You can also get extra badges at the reception for the same price.</p>
{% else %}
<p><em>
Min size: 64x64 - Max Size: 5MB, 2048x2048 - Formats: jpg, png<br />