User names cannot contain @.

This commit is contained in:
rimu 2024-02-22 14:18:21 +13:00
parent 1af3ee8649
commit bc2211a540

View file

@ -32,6 +32,8 @@ class RegistrationForm(FlaskForm):
raise ValidationError(_l('An account with this email address already exists.')) raise ValidationError(_l('An account with this email address already exists.'))
def validate_user_name(self, user_name): def validate_user_name(self, user_name):
if '@' in user_name.data:
raise ValidationError(_l('User names cannot contain @.'))
user = User.query.filter(func.lower(User.user_name) == func.lower(user_name.data.strip())).filter_by(ap_id=None).first() user = User.query.filter(func.lower(User.user_name) == func.lower(user_name.data.strip())).filter_by(ap_id=None).first()
if user is not None: if user is not None:
if user.deleted: if user.deleted: