This commit is contained in:
pluja 2020-08-27 10:15:20 +02:00
parent 454574ce49
commit 1c2a9169e6

View File

@ -437,9 +437,10 @@ def register():
form = RegistrationForm() form = RegistrationForm()
if form.validate_on_submit(): if form.validate_on_submit():
if isTwitterUser(form.username.data): if User.query.filter_by(username=form.username.data).first():
flash('This is username is taken! Choose a different one.') flash("This username is taken! Try with another.")
else: return redirect(request.referrer)
user = User(username=form.username.data) user = User(username=form.username.data)
user.set_password(form.password.data) user.set_password(form.password.data)
db.session.add(user) db.session.add(user)