mirror of
https://codeberg.org/rimu/pyfedi
synced 2025-01-23 11:26:56 -08:00
disallow spaces in user names #320
This commit is contained in:
parent
34203bd92a
commit
5cb0644b46
1 changed files with 3 additions and 0 deletions
|
@ -32,6 +32,9 @@ class RegistrationForm(FlaskForm):
|
|||
raise ValidationError(_l('An account with this email address already exists.'))
|
||||
|
||||
def validate_user_name(self, user_name):
|
||||
user_name.data = user_name.data.strip()
|
||||
if ' ' in user_name.data:
|
||||
raise ValidationError(_l('User names cannot contain spaces.'))
|
||||
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()
|
||||
|
|
Loading…
Reference in a new issue