Jul 8 - Implement QR code per facility
This commit is contained in:
+23
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user