Jul 16 - Fill the gaps between Single-tenant mode and Multi-tenant mode - MT3

This commit is contained in:
2026-07-16 17:17:44 -04:00
parent a60afc6c41
commit 02b030b1d2
12 changed files with 1294 additions and 90 deletions
+31 -1
View File
@@ -319,4 +319,34 @@ class SetPasswordForm(FlaskForm):
def validate_username(self, field):
existing = User.query.filter_by(username=field.data.strip()).first()
if existing:
raise ValidationError('This username is already taken. Please choose another.')
raise ValidationError('This username is already taken. Please choose another.')
# ── Public QR issue report (phase42) ─────────────────────────────────────────
class PublicIssueReportForm(FlaskForm):
"""Login-free issue report submitted from a facility's or area's public QR page.
Ported from the single-tenant tree, with MT's occupant-chosen `severity`
field retained (the ST original always filed at 'medium').
`website` is a honeypot: real users never see it (hidden via CSS); bots
that fill every field trip it and the submission is silently rejected.
"""
area_label = StringField('Where in the building?',
validators=[Optional(), Length(max=120)])
description = TextAreaField('Describe the problem',
validators=[DataRequired(), Length(min=5, max=2000)])
severity = SelectField('How urgent is it?', choices=[
('low', 'Minor — can wait'),
('medium', 'Normal'),
('high', 'Urgent — needs attention today'),
], default='medium', validators=[Optional()])
reporter_name = StringField('Your name (optional)',
validators=[Optional(), Length(max=100)])
reporter_contact = StringField('Email or phone (optional)',
validators=[Optional(), Length(max=120)])
photos = MultipleFileField('Add photos (optional, up to 5)',
validators=[Optional(),
FileAllowed(['jpg', 'jpeg', 'png', 'gif'],
'Images only (jpg, png, gif).')])
website = StringField('Website') # honeypot — must stay empty