refactor custom user compatability
pep8
use hashlib to generate login code