Jul 8 - Implement QR code per facility

This commit is contained in:
2026-07-08 13:06:52 -04:00
parent d0e72af188
commit ff3c76c0d8
11 changed files with 581 additions and 4 deletions
+23 -1
View File
@@ -274,4 +274,26 @@ 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 facility QR — occupant "Report a problem" ─────────────────────────
class PublicIssueReportForm(FlaskForm):
"""Login-free issue report submitted from a facility's public QR page.
`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)])
reporter_name = StringField('Your name (optional)',
validators=[Optional(), Length(max=100)])
reporter_contact = StringField('Email or phone (optional)',
validators=[Optional(), Length(max=120)])
photo = FileField('Add a photo (optional)',
validators=[Optional(),
FileAllowed(['jpg', 'jpeg', 'png', 'gif'],
'Images only (jpg, png, gif).')])
website = StringField('Website') # honeypot — must stay empty