mirror of https://git.48k.eu/ogcp
views: accept only user credentials without whitespace
Check the presence of whitespace for new usernames or passwords. Usernames with whitespace can't be deleted because whitespace is the separator of each element selected in the form.master
parent
4c21e370a3
commit
b3b47ac0cb
|
@ -3485,6 +3485,14 @@ def user_add_post():
|
|||
flash(form.errors, category='error')
|
||||
return redirect(url_for('users'))
|
||||
|
||||
if re.search(r'\s', form.username.data):
|
||||
flash(_('The username cannot contain spaces'), category='error')
|
||||
return redirect(url_for('users'))
|
||||
|
||||
if re.search(r'\s', form.pwd.data):
|
||||
flash(_('The password cannot contain spaces'), category='error')
|
||||
return redirect(url_for('users'))
|
||||
|
||||
if get_user(form.username.data):
|
||||
flash(_('This username already exists'), category='error')
|
||||
return redirect(url_for('users'))
|
||||
|
|
Loading…
Reference in New Issue