MantisBT: master e6e5a878

Author Committer Branch Timestamp Parent
realitix community master 2020-03-25 02:11 master 650df76f
Affected Issues  0026811: Username regex is too strict by default
Changeset

Increase TLD max length when validating usernames

The regex used to validate usernames limits the top-level domain part
to 4 chars. However, a lot of domains exceed this rule. The longest
one is currently 18 chars.

Fixes 0026811

The following python code returns the longest domain:

import urllib2

def is_ascii(s):
    return all(ord(c) < 128 for c in s)

data = urllib2.urlopen("https://publicsuffix.org/list/public_suffix_list.dat")
nb_char = 0
longest_domain = None
for line in data:
    if not line.startswith('//') and '.' not in line and is_ascii(line):
        d = line.strip()
        if len(d) > nb_char:
            nb_char = len(d)
            longest_domain = d
mod - config_defaults_inc.php Diff File