mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-15 01:48:18 -05:00
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:
@@ -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:])
|
||||
|
||||
Reference in New Issue
Block a user