VExistingUname: strip surrounding spaces

This was causing all pages that use this validator to be unable to
handle leading/trailing spaces around the username, since when chkuser()
is called it will always return None due to their presence. Changing
this will make a lot of pages more tolerant with usernames, like the
message compose page, pages for banning users, adding them as approved
submitters or moderators, etc.
This commit is contained in:
Chad Birch
2015-05-21 19:10:03 -06:00
parent e772017d2e
commit f4325ab2e8

View File

@@ -1596,6 +1596,8 @@ class VExistingUname(VRequired):
VRequired.__init__(self, item, errors.NO_USER, *a, **kw)
def run(self, name):
if name:
name = name.strip()
if name and name.startswith('~') and c.user_is_admin:
try:
user_id = int(name[1:])