Fix case sensitivity for duplicate username creation

This commit is contained in:
Ronan 2023-08-31 16:26:48 +10:00 committed by GitHub
parent ad9e4938bc
commit 7fcd2b8aa6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -408,7 +408,7 @@ class User(db.Model):
Create local user witch stores username / password in the DB
"""
# check if username existed
user = User.query.filter(User.username == self.username).first()
user = User.query.filter(User.username.lower() == self.username.lower()).first()
if user:
return {'status': False, 'msg': 'Username is already in use'}