Improved support for custom user models

Support for custom user models with a non-standard username field