fix missing username pattern

This commit is contained in:
Patrick Jentsch 2023-03-29 14:32:52 +02:00
parent e4a8ad911f
commit 35b239877a

View File

@ -12,6 +12,7 @@ from werkzeug.utils import secure_filename
import json
import jwt
import os
import re
import requests
import secrets
import shutil
@ -518,6 +519,7 @@ class User(HashidMixin, UserMixin, db.Model):
# Fields
email = db.Column(db.String(254), index=True, unique=True)
username = db.Column(db.String(64), index=True, unique=True)
username_pattern = re.compile(r'^[A-Za-zÄÖÜäöüß0-9_.]*$')
password_hash = db.Column(db.String(128))
confirmed = db.Column(db.Boolean, default=False)
member_since = db.Column(db.DateTime(), default=datetime.utcnow)
@ -865,11 +867,13 @@ class User(HashidMixin, UserMixin, db.Model):
'organization': self.organization,
'job_status_mail_notification_level': \
self.setting_job_status_mail_notification_level.name,
'profile_privacy_settings': {
'is_public': self.is_public,
'show_email': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_EMAIL),
'show_last_seen': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_LAST_SEEN),
'show_member_since': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_MEMBER_SINCE)
}
}
if backrefs:
json_serializeable['role'] = \
self.role.to_json_serializeable(backrefs=True)