We're so back #16
4
app.py
4
app.py
|
@ -139,8 +139,10 @@ async def welcome(request, order: Order, quota: Quotas):
|
||||||
else:
|
else:
|
||||||
room_members.append(await app.ctx.om.get_order(code=member_id, cached=True))
|
room_members.append(await app.ctx.om.get_order(code=member_id, cached=True))
|
||||||
|
|
||||||
|
print (order.room_errors)
|
||||||
|
|
||||||
tpl = app.ctx.tpl.get_template('welcome.html')
|
tpl = app.ctx.tpl.get_template('welcome.html')
|
||||||
return html(tpl.render(order=order, quota=quota, room_members=room_members, pending_roommates=pending_roommates, ROOM_ERROR_MESSAGES=ROOM_ERROR_MESSAGES))
|
return html(tpl.render(order=order, quota=quota, room_members=room_members, pending_roommates=pending_roommates, ROOM_ERROR_MESSAGES=ROOM_ERROR_TYPES))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/manage/download_ticket")
|
@app.route("/manage/download_ticket")
|
||||||
|
|
|
@ -117,5 +117,6 @@ TG_CHAT_ID = -1234567
|
||||||
ADMINS = ['XXXXX', 'YYYYY']
|
ADMINS = ['XXXXX', 'YYYYY']
|
||||||
|
|
||||||
SMTP_HOST = 'host'
|
SMTP_HOST = 'host'
|
||||||
|
SMTP_PORT = 0
|
||||||
SMTP_USER = 'user'
|
SMTP_USER = 'user'
|
||||||
SMTP_PASSWORD = 'pw'
|
SMTP_PASSWORD = 'pw'
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
from email.mime.text import MIMEText
|
||||||
|
from email.mime.multipart import MIMEMultipart
|
||||||
|
from messages import ROOM_ERROR_TYPES
|
||||||
|
import smtplib
|
||||||
|
from messages import *
|
||||||
|
from config import SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASSWORD, SMTP_ADMIN_PASS
|
||||||
|
|
||||||
|
def send_unconfirm_message (room_order, room_errors, orders, title):
|
||||||
|
memberMessages = []
|
||||||
|
|
||||||
|
issues_plain = ""
|
||||||
|
issues_html = "<ul>"
|
||||||
|
|
||||||
|
for err in room_errors:
|
||||||
|
if err in ROOM_ERROR_TYPES.keys():
|
||||||
|
issues_plain += f"{ROOM_ERROR_TYPES[err]}"
|
||||||
|
issues_html += f"<li>{ROOM_ERROR_TYPES[err]}</li>"
|
||||||
|
issues_html += "</ul>"
|
||||||
|
|
||||||
|
for member in orders:
|
||||||
|
plain_body = ROOM_UNCONFIRM_TEXT['plain'].format(member.name, room_order.room_name, issues_plain)
|
||||||
|
html_body = ROOM_UNCONFIRM_TEXT['html'].format(member.name, room_order.room_name, issues_html)
|
||||||
|
plain_text = MIMEText(plain_body, "plain")
|
||||||
|
html_text = MIMEText(html_body, "html")
|
||||||
|
message = MIMEMultipart("alternative")
|
||||||
|
message.attach(plain_text)
|
||||||
|
message.attach(html_text)
|
||||||
|
message['Subject'] = '[Furizon] Your room cannot be confirmed'
|
||||||
|
message['From'] = 'Furizon <no-reply@furizon.net>'
|
||||||
|
message['To'] = f"{member.name} <{member.email}>"
|
||||||
|
memberMessages.append(message)
|
||||||
|
|
||||||
|
if len(memberMessages) == 0: return
|
||||||
|
|
||||||
|
def render_email_template(title = "", body = ""):
|
||||||
|
tpl = app.ctx.tpl.get_template('email/comunication.html')
|
||||||
|
return str(tpl.render(title=title, body=body))
|
4
ext.py
4
ext.py
|
@ -98,7 +98,7 @@ class Order:
|
||||||
self.payment_provider = data['payment_provider']
|
self.payment_provider = data['payment_provider']
|
||||||
self.comment = data['comment']
|
self.comment = data['comment']
|
||||||
self.phone = data['phone']
|
self.phone = data['phone']
|
||||||
self.room_issues = []
|
self.room_errors = []
|
||||||
self.loadAns()
|
self.loadAns()
|
||||||
def loadAns(self):
|
def loadAns(self):
|
||||||
self.shirt_size = self.ans('shirt_size')
|
self.shirt_size = self.ans('shirt_size')
|
||||||
|
@ -133,7 +133,7 @@ class Order:
|
||||||
return self.data[var]
|
return self.data[var]
|
||||||
|
|
||||||
def set_room_errors (self, to_set):
|
def set_room_errors (self, to_set):
|
||||||
for s in to_set: self.room_issues.append (s)
|
for s in to_set: self.room_errors.append (s)
|
||||||
|
|
||||||
def ans(self, name):
|
def ans(self, name):
|
||||||
for p in self.data['positions']:
|
for p in self.data['positions']:
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
from config import *
|
||||||
|
from PIL import Image, ImageDraw, ImageFont
|
||||||
|
from sanic import Blueprint, exceptions
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
jobs = []
|
||||||
|
|
||||||
|
def draw_profile (source, member, position, font, size=(170, 170), border_width=5):
|
||||||
|
idraw = ImageDraw.Draw(source)
|
||||||
|
source_size = source.size
|
||||||
|
main_fill = (187, 198, 206)
|
||||||
|
propic_x = position[0]
|
||||||
|
propic_y = (source_size[1] // 2) - (size[1] // 2)
|
||||||
|
border_loc = (propic_x, propic_y, propic_x + size[0] + border_width * 2, propic_y + size[1] + border_width *2)
|
||||||
|
profile_location = (propic_x + border_width, propic_y + border_width)
|
||||||
|
propic_name_y = propic_y + size[1] + border_width + 20
|
||||||
|
border_color = SPONSORSHIP_COLOR_MAP[member['sponsorship']] if member['sponsorship'] in SPONSORSHIP_COLOR_MAP.keys() else (84, 110, 122)
|
||||||
|
# Draw border
|
||||||
|
idraw.rounded_rectangle(border_loc, border_width, border_color)
|
||||||
|
# Draw profile picture
|
||||||
|
with Image.open(f'res/propic/{member['propic'] or 'default.png'}') as to_add:
|
||||||
|
source.paste(to_add.resize (size), profile_location)
|
||||||
|
name_len = idraw.textlength(str(member['name']), font)
|
||||||
|
calc_size = 0
|
||||||
|
if name_len > size[0]:
|
||||||
|
calc_size = size[0] * 20 / name_len if name_len > size[0] else 20
|
||||||
|
font = ImageFont.truetype(font.path, calc_size)
|
||||||
|
name_len = idraw.textlength(str(member['name']), font)
|
||||||
|
name_loc = (position[0] + ((size[0] / 2) - name_len / 2), propic_name_y + (calc_size/2))
|
||||||
|
name_color = SPONSORSHIP_COLOR_MAP[member['sponsorship']] if member['sponsorship'] in SPONSORSHIP_COLOR_MAP.keys() else main_fill
|
||||||
|
idraw.text(name_loc, str(member['name']), font=font, fill=name_color)
|
||||||
|
|
||||||
|
async def generate_room_preview(request, code, room_data):
|
||||||
|
font_path = f'res/font/NotoSans-Bold.ttf'
|
||||||
|
main_fill = (187, 198, 206)
|
||||||
|
propic_size = (170, 170)
|
||||||
|
logo_size = (200, 43)
|
||||||
|
border_width = 5
|
||||||
|
propic_gap = 50
|
||||||
|
propic_width = propic_size[0] + (border_width * 2)
|
||||||
|
propic_total_width = propic_width + propic_gap
|
||||||
|
jobs.append(code)
|
||||||
|
try:
|
||||||
|
room_data = await get_room(request, code) if not room_data else room_data
|
||||||
|
if not room_data: return
|
||||||
|
width = max([(propic_width + propic_gap) * int(room_data['capacity']) + propic_gap, 670])
|
||||||
|
height = int(width * 0.525)
|
||||||
|
font = ImageFont.truetype(font_path, 20)
|
||||||
|
|
||||||
|
# Recalculate gap
|
||||||
|
propic_gap = (width - (propic_width * int(room_data['capacity']))) // (int(room_data['capacity']) + 1)
|
||||||
|
propic_total_width = propic_width + propic_gap
|
||||||
|
|
||||||
|
# Define output image
|
||||||
|
with Image.new('RGB', (width, height), (17, 25, 31)) as source:
|
||||||
|
# Draw logo
|
||||||
|
with (Image.open('res/furizon.png') as logo, logo.resize(logo_size).convert('RGBA') as resized_logo):
|
||||||
|
source.paste(resized_logo, ((source.size[0] // 2) - (logo_size[0] // 2), 10), resized_logo)
|
||||||
|
i_draw = ImageDraw.Draw(source)
|
||||||
|
# Draw room's name
|
||||||
|
room_name_len = i_draw.textlength(room_data['name'], font)
|
||||||
|
i_draw.text((((width / 2) - room_name_len / 2), 55), room_data['name'], font=font, fill=main_fill)
|
||||||
|
# Draw members
|
||||||
|
for m in range (room_data['capacity']):
|
||||||
|
member = room_data['members'][m] if m < len(room_data['members']) else { 'name': 'Empty', 'propic': '../new.png', 'sponsorship': None }
|
||||||
|
font = ImageFont.truetype(font_path, 20)
|
||||||
|
draw_profile(source, member, (propic_gap + (propic_total_width * m), 63), font, propic_size, border_width)
|
||||||
|
source.save(f'res/rooms/{code}.jpg', 'JPEG', quality=60)
|
||||||
|
except Exception as err:
|
||||||
|
if EXTRA_PRINTS: print(err)
|
||||||
|
finally:
|
||||||
|
# Remove fault job
|
||||||
|
if len(jobs) > 0: jobs.pop()
|
||||||
|
if not room_data:
|
||||||
|
raise exceptions.SanicException("There's no room with that code.", status_code=404)
|
||||||
|
|
||||||
|
async def get_room (request, code):
|
||||||
|
order_data = await request.app.ctx.om.get_order(code=code)
|
||||||
|
if not order_data or not order_data.room_owner: return None
|
||||||
|
members_map = [{'name': order_data.name, 'propic': order_data.propic, 'sponsorship': order_data.sponsorship}]
|
||||||
|
for member_code in order_data.room_members:
|
||||||
|
if member_code == order_data.code: continue
|
||||||
|
member_order = await request.app.ctx.om.get_order(code=member_code)
|
||||||
|
if not member_order: continue
|
||||||
|
members_map.append ({'name': member_order.name, 'propic': member_order.propic, 'sponsorship': member_order.sponsorship})
|
||||||
|
return {'name': order_data.room_name,
|
||||||
|
'confirmed': order_data.room_confirmed,
|
||||||
|
'capacity': order_data.room_person_no,
|
||||||
|
'free_spots': order_data.room_person_no - len(members_map),
|
||||||
|
'members': members_map}
|
11
messages.py
11
messages.py
|
@ -1,6 +1,13 @@
|
||||||
ROOM_ERROR_MESSAGES = {
|
ROOM_ERROR_TYPES = {
|
||||||
'room_id_mismatch': "There's a member in your room that is actually in another room, too. Please contact us as soon as possible in order to fix this issue.",
|
'room_id_mismatch': "There's a member in your room that is actually in another room, too. Please contact us as soon as possible in order to fix this issue.",
|
||||||
'unpaid': "Somebody in your room has not paid for their reservation, yet.",
|
'unpaid': "Somebody in your room has not paid for their reservation, yet.",
|
||||||
'type_mismatch': "A member in your room has a ticket for a different type of room capacity. This happens when users swap their room types with others, without abandoning the room.",
|
'type_mismatch': "A member in your room has a ticket for a different type of room capacity. This happens when users swap their room types with others, without abandoning the room.",
|
||||||
'daily': "Some member in your room has a Daily ticket. These tickets do not include a hotel reservation"
|
'daily': "Some member in your room has a Daily ticket. These tickets do not include a hotel reservation.",
|
||||||
|
'capacity_mismatch': "The number of people in your room mismatches your type of ticket."
|
||||||
|
}
|
||||||
|
|
||||||
|
ROOM_UNCONFIRM_TITLE = "Your room got unconfirmed"
|
||||||
|
ROOM_UNCONFIRM_TEXT = {
|
||||||
|
'html': "Hello <b>{0}</b><br>We had to unconfirm your room '{1}' due to the following problem/s:<br>{2}<br>Please contact your room's owner or contact our support for further informations at <a href=\"https://furizon.net/contact/\"> https://furizon.net/contact/</a>.<br>Thank you",
|
||||||
|
'plain': "Hello {0}\nWe had to unconfirm your room '{1}' due to the following problem/s:\n{2}\nPlease contact your room's owner or contact our support for further informations at https://furizon.net/contact/.\nThank you"
|
||||||
}
|
}
|
90
room.py
90
room.py
|
@ -3,11 +3,8 @@ 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
|
||||||
from PIL import Image, ImageDraw, ImageFont
|
|
||||||
import textwrap
|
|
||||||
import os
|
import os
|
||||||
|
from image_util import generate_room_preview, get_room
|
||||||
jobs = []
|
|
||||||
|
|
||||||
bp = Blueprint("room", url_prefix="/manage/room")
|
bp = Blueprint("room", url_prefix="/manage/room")
|
||||||
|
|
||||||
|
@ -357,21 +354,6 @@ async def confirm_room(request, order: Order, quotas: Quotas):
|
||||||
|
|
||||||
return redirect('/manage/welcome')
|
return redirect('/manage/welcome')
|
||||||
|
|
||||||
async def get_room (request, code):
|
|
||||||
order_data = await request.app.ctx.om.get_order(code=code)
|
|
||||||
if not order_data or not order_data.room_owner: return None
|
|
||||||
members_map = [{'name': order_data.name, 'propic': order_data.propic, 'sponsorship': order_data.sponsorship}]
|
|
||||||
for member_code in order_data.room_members:
|
|
||||||
if member_code == order_data.code: continue
|
|
||||||
member_order = await request.app.ctx.om.get_order(code=member_code)
|
|
||||||
if not member_order: continue
|
|
||||||
members_map.append ({'name': member_order.name, 'propic': member_order.propic, 'sponsorship': member_order.sponsorship})
|
|
||||||
return {'name': order_data.room_name,
|
|
||||||
'confirmed': order_data.room_confirmed,
|
|
||||||
'capacity': order_data.room_person_no,
|
|
||||||
'free_spots': order_data.room_person_no - len(members_map),
|
|
||||||
'members': members_map}
|
|
||||||
|
|
||||||
async def get_room_with_order (request, code):
|
async def get_room_with_order (request, code):
|
||||||
order_data = await request.app.ctx.om.get_order(code=code)
|
order_data = await request.app.ctx.om.get_order(code=code)
|
||||||
if not order_data or not order_data.room_owner: return None
|
if not order_data or not order_data.room_owner: return None
|
||||||
|
@ -383,75 +365,6 @@ def remove_room_preview(code):
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
if (EXTRA_PRINTS): print(ex)
|
if (EXTRA_PRINTS): print(ex)
|
||||||
|
|
||||||
def draw_profile (source, member, position, font, size=(170, 170), border_width=5):
|
|
||||||
idraw = ImageDraw.Draw(source)
|
|
||||||
source_size = source.size
|
|
||||||
main_fill = (187, 198, 206)
|
|
||||||
propic_x = position[0]
|
|
||||||
propic_y = (source_size[1] // 2) - (size[1] // 2)
|
|
||||||
border_loc = (propic_x, propic_y, propic_x + size[0] + border_width * 2, propic_y + size[1] + border_width *2)
|
|
||||||
profile_location = (propic_x + border_width, propic_y + border_width)
|
|
||||||
propic_name_y = propic_y + size[1] + border_width + 20
|
|
||||||
border_color = SPONSORSHIP_COLOR_MAP[member['sponsorship']] if member['sponsorship'] in SPONSORSHIP_COLOR_MAP.keys() else (84, 110, 122)
|
|
||||||
# Draw border
|
|
||||||
idraw.rounded_rectangle(border_loc, border_width, border_color)
|
|
||||||
# Draw profile picture
|
|
||||||
with Image.open(f'res/propic/{member['propic'] or 'default.png'}') as to_add:
|
|
||||||
source.paste(to_add.resize (size), profile_location)
|
|
||||||
name_len = idraw.textlength(str(member['name']), font)
|
|
||||||
calc_size = 0
|
|
||||||
if name_len > size[0]:
|
|
||||||
calc_size = size[0] * 20 / name_len if name_len > size[0] else 20
|
|
||||||
font = ImageFont.truetype(font.path, calc_size)
|
|
||||||
name_len = idraw.textlength(str(member['name']), font)
|
|
||||||
name_loc = (position[0] + ((size[0] / 2) - name_len / 2), propic_name_y + (calc_size/2))
|
|
||||||
name_color = SPONSORSHIP_COLOR_MAP[member['sponsorship']] if member['sponsorship'] in SPONSORSHIP_COLOR_MAP.keys() else main_fill
|
|
||||||
idraw.text(name_loc, str(member['name']), font=font, fill=name_color)
|
|
||||||
|
|
||||||
async def generate_room_preview(request, code, room_data):
|
|
||||||
font_path = f'res/font/NotoSans-Bold.ttf'
|
|
||||||
main_fill = (187, 198, 206)
|
|
||||||
propic_size = (170, 170)
|
|
||||||
logo_size = (200, 43)
|
|
||||||
border_width = 5
|
|
||||||
propic_gap = 50
|
|
||||||
propic_width = propic_size[0] + (border_width * 2)
|
|
||||||
propic_total_width = propic_width + propic_gap
|
|
||||||
jobs.append(code)
|
|
||||||
try:
|
|
||||||
room_data = await get_room(request, code) if not room_data else room_data
|
|
||||||
if not room_data: return
|
|
||||||
width = max([(propic_width + propic_gap) * int(room_data['capacity']) + propic_gap, 670])
|
|
||||||
height = int(width * 0.525)
|
|
||||||
font = ImageFont.truetype(font_path, 20)
|
|
||||||
|
|
||||||
# Recalculate gap
|
|
||||||
propic_gap = (width - (propic_width * int(room_data['capacity']))) // (int(room_data['capacity']) + 1)
|
|
||||||
propic_total_width = propic_width + propic_gap
|
|
||||||
|
|
||||||
# Define output image
|
|
||||||
with Image.new('RGB', (width, height), (17, 25, 31)) as source:
|
|
||||||
# Draw logo
|
|
||||||
with (Image.open('res/furizon.png') as logo, logo.resize(logo_size).convert('RGBA') as resized_logo):
|
|
||||||
source.paste(resized_logo, ((source.size[0] // 2) - (logo_size[0] // 2), 10), resized_logo)
|
|
||||||
i_draw = ImageDraw.Draw(source)
|
|
||||||
# Draw room's name
|
|
||||||
room_name_len = i_draw.textlength(room_data['name'], font)
|
|
||||||
i_draw.text((((width / 2) - room_name_len / 2), 55), room_data['name'], font=font, fill=main_fill)
|
|
||||||
# Draw members
|
|
||||||
for m in range (room_data['capacity']):
|
|
||||||
member = room_data['members'][m] if m < len(room_data['members']) else { 'name': 'Empty', 'propic': '../new.png', 'sponsorship': None }
|
|
||||||
font = ImageFont.truetype(font_path, 20)
|
|
||||||
draw_profile(source, member, (propic_gap + (propic_total_width * m), 63), font, propic_size, border_width)
|
|
||||||
source.save(f'res/rooms/{code}.jpg', 'JPEG', quality=60)
|
|
||||||
except Exception as err:
|
|
||||||
if EXTRA_PRINTS: print(err)
|
|
||||||
finally:
|
|
||||||
# Remove fault job
|
|
||||||
if len(jobs) > 0: jobs.pop()
|
|
||||||
if not room_data:
|
|
||||||
raise exceptions.SanicException("There's no room with that code.", status_code=404)
|
|
||||||
|
|
||||||
@bp.route("/view/<code>")
|
@bp.route("/view/<code>")
|
||||||
async def get_view(request, code):
|
async def get_view(request, code):
|
||||||
room_file_name = f"res/rooms/{code}.jpg"
|
room_file_name = f"res/rooms/{code}.jpg"
|
||||||
|
@ -461,4 +374,3 @@ async def get_view(request, code):
|
||||||
await generate_room_preview(request, code, room_data)
|
await generate_room_preview(request, code, room_data)
|
||||||
tpl = request.app.ctx.tpl.get_template('view_room.html')
|
tpl = request.app.ctx.tpl.get_template('view_room.html')
|
||||||
return html(tpl.render(preview=room_file_name, room_data=room_data))
|
return html(tpl.render(preview=room_file_name, room_data=room_data))
|
||||||
|
|
|
@ -14,7 +14,8 @@
|
||||||
{% if order.room_id and not order.room_confirmed %}
|
{% if order.room_id and not order.room_confirmed %}
|
||||||
<p class="notice">⚠️ Your room hasn't been confirmed yet. Unconfirmed rooms are subject to changes by the staff as we optimize for hotel capacity.</p>
|
<p class="notice">⚠️ Your room hasn't been confirmed yet. Unconfirmed rooms are subject to changes by the staff as we optimize for hotel capacity.</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if order.room_id and len(order.room_issues) > 0 %}
|
{{len(order.room_errors)}}
|
||||||
|
{% if order.room_id and len(order.room_errors) > 0 %}
|
||||||
<p class="notice">⚠️ There are some issues with your room:
|
<p class="notice">⚠️ There are some issues with your room:
|
||||||
<ul>
|
<ul>
|
||||||
{% for issue in issues %}
|
{% for issue in issues %}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<meta name="supported-color-schemes" content="light dark">
|
||||||
|
<title>Simple Transactional Email</title>
|
||||||
|
<style media="all" type="text/css">
|
||||||
|
:root{
|
||||||
|
--main-background: #fff; --h2-color: #24333e; --color: hsl(205deg, 20%, 32%);
|
||||||
|
--font-family: system-ui,-apple-system,"Segoe UI","Roboto","Ubuntu","Cantarell","Noto Sans",sans-serif,"Apple Color Emoji","Segoe UI Emoji","Segoe UI Symbol","Noto Color Emoji";
|
||||||
|
}
|
||||||
|
*, ::after, ::before { box-sizing:border-box; background-repeat:no-repeat; }
|
||||||
|
body { width: 100%; margin: 0; background-color: var(--main-background); }
|
||||||
|
.container { max-width: 40em; padding: 1em; box-sizing: border-box; margin: 0 auto; }
|
||||||
|
h2 { --font-size: 1.75rem; --typography-spacing-vertical: 2.625rem; color: var(--h2-color) }
|
||||||
|
h1, h2, h3, h4, h5, h6 { margin-top: 0; margin-bottom: var(--typography-spacing-vertical); font-size: var(--font-size); font-family: var(--font-family);}
|
||||||
|
address, blockquote, dl, figure, form, ol, p, pre, table, ul {margin-top: 0; color: var(--color); font-style: normal; font-weight: 400; font-family: var(--font-family);}
|
||||||
|
img.con-logo {content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKoAAAAlCAYAAADSkHKPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAALiMAAC4jAXilP3YAAAzuSURBVHja7ZwJVBPXGscDMago7mxJIKgFcXlKxeVYte+pVK0LWpXnrhy32qpt1efr02rx9PncEAJJCIuIiigQEcIOUhQBWYRUEQUEBHGpdRdFCiQz37szGXBKgyQIaHG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AAAAElFTkSuQmCC');}
|
||||||
|
|
||||||
|
/* Dark theme */
|
||||||
|
@media only screen and (prefers-color-scheme: dark) {
|
||||||
|
:root{ --main-background: #11191f; --h2-color: #e1e6eb; --color: hsl(205deg, 16%, 77%);}
|
||||||
|
.icon {filter: invert(1);}
|
||||||
|
img.con-logo { content: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKoAAAAlCAYAAADSkHKPAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAALiMAAC4jAXilP3YAAA39SURBVHja7VwJVJXVFrZBK8sGS1FAIU0ya5WK+laDvVf61CzHojRNWTa8UsvM13uvXkWreqmhAhe4DCrO0xWZZZBEZJ5uJCDgBUFUckIU7vSPZ7/9DxdueBkuguO/1/rW+Ydzzn+G7+yzzz7n3h49rpHQNP0MyzPQHhiOZhDJHQEhzJge10FOkpP30Ty9juVpX0LIfT0UuXWko0S1C6x5yvWoC0e4Oc0Di/la6d1blqjsTxxhPmkTXDvvEQDQ67rUhaPnyJqfcMB5Kr17ixKVJvSzN3t9TMQ0COvxtNKzClEVUUQhqiKKKERVRCGqIoooRFVEEWuiMhwdSXP0XHvAsuxEIR9CyOOWZ1dTHiyFu5gPTY+yNy0APMTwzHqsy0Ysj7NYP45+x946tVpXwr7S1vfxm32xDI9ZgPcPdqDMvazS3NHO+8fqSN2Dtz1ROwc6XSaEp+XZ1ZSH5Vl/2afrjR3zCM3T3gIoQg37cwdefgSJM4lm6VUYd1V9ff1DtmYHHHx0V2xiCP5Z/N5UG0S6gyPcIhwgKRiHbZHOgM9iKZaaZouEYn1Z8xRLfCT2/U39QujRWC8/TH+2RTkM2ObZDGdegnneebtq1KPYCPn2gGGZDd1FVDOYXa12u0TNLRAW7zddQSSGGWuLqFiubHvr1FQ3jja1tdOF3xuJ77QdIjvHFFBADW+PqMLgZKVZoSODpxYHwQzFRrUnn2tAVI4wi601JF43IKoQlWaz2bUr7W0hL8z3sjxrrL3CROGYf+B73u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xLLpRgJr9SZPJNLirgG34qLWdGxbmOyx577ffVyd/llqX9qGZz1sIfN4CE5+7IIDkzBtxTQlaG+PV+3Ti6hVnkr7X18R7QU74z4bwzaqNwcHBE3ABdM+12EJt1Z7jmJI2Dv4S4UQRR+gPdTrdPbKvskuJis+ebj6yd1ug1VX/pk0+D+/fseqLktivs84c+CdzOWUpezlleda55P++1JkzBnYQNKT3qfh1y2v2r7uQt9cPojYHZPmrgxf6+2/p8KkevV7fH2237wTgtUN3lJNl2b9ZvmENJNNzNuzVz1Hbpgl26yW49LB08Bjvmfb/eE343ZYQV4CZmIfKR/KiLM+uANfKc3twHfP48+KzfaJaCyqxgQd2+H1SEL4273jsGjgdv6bkdIKPsKboOsKWRa3ucypu3XJdlM/ZX3f6X9oUqvb3DQoa1kOR20oELWgL9uazOSjIKX23atXRSJ+qmrh11bUJPnMLbJiJHZZDh7zuPrXf57WiSL/imK0Blf5q9QdeGk0vpcsU6QoRfOThW9QTtfv8EnUxPhUn49fM08W3bTpeIecP+A4rjvDNj9jinxMYHPyKl5dCUEW6T7aFhjpn7PHzL4nwLa+JW+PerkkAqEWPRfl8GLct0D8gIHiK0oSKXEsRDgrlaPw+PxLhG3Iydq3tXbzLiWv7Zu9RfagKDHy9S41cRRSxn7A9MzWqFRl7fOcLaySbEZRmUuRGkXg/v3sO7vKZnbbL301pDUVueMG1kugC/T+Qf4ayXaBvkgAAAABJRU5ErkJggg=='); }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
</html>
|
||||||
|
<main class="container">
|
||||||
|
<header>
|
||||||
|
<picture style="display: inline-flex; justify-content: center;">
|
||||||
|
<img class="con-logo" style="height:2rem;text-align:center;">
|
||||||
|
</picture>
|
||||||
|
</header>
|
||||||
|
<article>
|
||||||
|
<h2>{{title}}</h2>
|
||||||
|
<p>{{body}}</p>
|
||||||
|
</article>
|
||||||
|
</main>
|
|
@ -17,7 +17,7 @@
|
||||||
<picture>
|
<picture>
|
||||||
<source srcset="/res/furizon.png" media="(prefers-color-scheme:dark)">
|
<source srcset="/res/furizon.png" media="(prefers-color-scheme:dark)">
|
||||||
<img src="/res/furizon-light.png" style="height:4rem;text-align:center;"
|
<img src="/res/furizon-light.png" style="height:4rem;text-align:center;"
|
||||||
onload="window.location.href = '/manage/noseocount/'">
|
onload="window.location.href = '/manage/nosecount/'">
|
||||||
</picture>
|
</picture>
|
||||||
</header>
|
</header>
|
||||||
</main>
|
</main>
|
||||||
|
|
26
utils.py
26
utils.py
|
@ -3,7 +3,7 @@ from sanic import exceptions
|
||||||
from config import *
|
from config import *
|
||||||
import httpx
|
import httpx
|
||||||
from email.mime.text import MIMEText
|
from email.mime.text import MIMEText
|
||||||
from messages import ROOM_ERROR_MESSAGES
|
from messages import ROOM_ERROR_TYPES
|
||||||
import smtplib
|
import smtplib
|
||||||
|
|
||||||
METADATA_TAG = "meta_data"
|
METADATA_TAG = "meta_data"
|
||||||
|
@ -164,7 +164,8 @@ async def validate_room(request, order, om):
|
||||||
check, room_errors, member_orders = await check_room(request, order, om)
|
check, room_errors, member_orders = await check_room(request, order, om)
|
||||||
if check == True: return
|
if check == True: return
|
||||||
print(f'[ROOM VALIDATION FAILED] {order.code} has failed room validation.', room_errors)
|
print(f'[ROOM VALIDATION FAILED] {order.code} has failed room validation.', room_errors)
|
||||||
order.set_room_errors(room_errors)
|
order.room_errors = room_errors
|
||||||
|
om.add_cache (order)
|
||||||
|
|
||||||
# End here if room is not confirmed
|
# End here if room is not confirmed
|
||||||
if not order.room_confirmed: return
|
if not order.room_confirmed: return
|
||||||
|
@ -175,25 +176,10 @@ async def validate_room(request, order, om):
|
||||||
# Build message
|
# Build message
|
||||||
issues_str = ""
|
issues_str = ""
|
||||||
for err in room_errors:
|
for err in room_errors:
|
||||||
if err in ROOM_ERROR_MESSAGES:
|
if err in ROOM_ERROR_TYPES:
|
||||||
issues_str += f" - {ROOM_ERROR_MESSAGES[err]}"
|
issues_str += f" - {ROOM_ERROR_TYPES[err]}"
|
||||||
|
|
||||||
memberMessages = []
|
s = smtplib.SMTP_SSL(SMTP_HOST, SMTP_PORT)
|
||||||
|
|
||||||
for member in member_orders:
|
|
||||||
msg_text = f"Hello {member.name}!\n\n"
|
|
||||||
msg_text += f"We had to unconfirm your room '{order.room_name}'"
|
|
||||||
msg_text += f" due to th{'ese issues' if len(room_errors) > 1 else 'is issue'}:\n{issues_str}\n\n"
|
|
||||||
msg_text += f"Please contact your room's owner or contact our support for further informations at https://furizon.net/contact/.\nThank you"
|
|
||||||
msg = MIMEText(msg_text)
|
|
||||||
msg['Subject'] = '[Furizon] Your room cannot be confirmed'
|
|
||||||
msg['From'] = 'Furizon <no-reply@furizon.net>'
|
|
||||||
msg['To'] = f"{member.name} <{member.email}>"
|
|
||||||
memberMessages.append(msg)
|
|
||||||
|
|
||||||
if len(memberMessages) == 0: return
|
|
||||||
|
|
||||||
s = smtplib.SMTP_SSL(SMTP_HOST, 587)
|
|
||||||
s.login(SMTP_USER, SMTP_PASSWORD)
|
s.login(SMTP_USER, SMTP_PASSWORD)
|
||||||
for message in memberMessages:
|
for message in memberMessages:
|
||||||
s.sendmail(message['From'], message['to'], message.as_string())
|
s.sendmail(message['From'], message['to'], message.as_string())
|
||||||
|
|
Loading…
Reference in New Issue