improved login to integrate with flask-admin