Added support for propic expiration
This commit is contained in:
parent
1a77952dbc
commit
75fd737baa
|
@ -2,12 +2,13 @@ from sanic.response import html, redirect, text
|
||||||
from sanic import Blueprint, exceptions
|
from sanic import Blueprint, exceptions
|
||||||
from random import choice
|
from random import choice
|
||||||
from ext import *
|
from ext import *
|
||||||
from config import headers
|
from config import headers, PROPIC_DEADLINE
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
from os.path import isfile
|
from os.path import isfile
|
||||||
from os import unlink
|
from os import unlink
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from hashlib import sha224
|
from hashlib import sha224
|
||||||
|
from time import time
|
||||||
|
|
||||||
bp = Blueprint("propic", url_prefix="/manage/propic")
|
bp = Blueprint("propic", url_prefix="/manage/propic")
|
||||||
|
|
||||||
|
@ -18,6 +19,9 @@ async def upload_propic(request, order: Order):
|
||||||
if order.propic_locked:
|
if order.propic_locked:
|
||||||
raise exceptions.BadRequest("You have been limited from further editing the propic.")
|
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':
|
if request.form.get('submit') == 'Delete main image':
|
||||||
await order.edit_answer('propic', None)
|
await order.edit_answer('propic', None)
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if time() > PROPIC_DEADLINE %}
|
{% 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 %}
|
{% else %}
|
||||||
<p><em>
|
<p><em>
|
||||||
Min size: 64x64 - Max Size: 5MB, 2048x2048 - Formats: jpg, png<br />
|
Min size: 64x64 - Max Size: 5MB, 2048x2048 - Formats: jpg, png<br />
|
||||||
|
|
Loading…
Reference in New Issue