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 json
import jwt import jwt
import os import os
import re
import requests import requests
import secrets import secrets
import shutil import shutil
@ -518,6 +519,7 @@ class User(HashidMixin, UserMixin, db.Model):
# Fields # Fields
email = db.Column(db.String(254), index=True, unique=True) email = db.Column(db.String(254), index=True, unique=True)
username = db.Column(db.String(64), 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)) password_hash = db.Column(db.String(128))
confirmed = db.Column(db.Boolean, default=False) confirmed = db.Column(db.Boolean, default=False)
member_since = db.Column(db.DateTime(), default=datetime.utcnow) member_since = db.Column(db.DateTime(), default=datetime.utcnow)
@ -865,10 +867,12 @@ class User(HashidMixin, UserMixin, db.Model):
'organization': self.organization, 'organization': self.organization,
'job_status_mail_notification_level': \ 'job_status_mail_notification_level': \
self.setting_job_status_mail_notification_level.name, self.setting_job_status_mail_notification_level.name,
'is_public': self.is_public, 'profile_privacy_settings': {
'show_email': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_EMAIL), 'is_public': self.is_public,
'show_last_seen': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_LAST_SEEN), 'show_email': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_EMAIL),
'show_member_since': self.has_profile_privacy_setting(ProfilePrivacySettings.SHOW_MEMBER_SINCE) '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: if backrefs:
json_serializeable['role'] = \ json_serializeable['role'] = \