Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import re
import uuid
import flask
import sqlalchemy
import tld
from .. import config, model, notify, util
from . import util as web_util
from .blueprint import web_api
from profanity import profanity
import wordfilter
tld.update_tld_names()
USERNAME_REGEX = re.compile(r'^[a-zA-Z0-9][a-zA-Z0-9_\-]*$')
USERNAME_LENGTH = 40
def is_valid_username(username):
return len(username) <= USERNAME_LENGTH and \
username and \
not profanity.contains_profanity(username) and \
not wordfilter.blacklisted(username) and \
USERNAME_REGEX.match(username)
def make_user_record(row, *, logged_in, total_users=None):
"""Given a database result row, create the JSON user object."""