Fixed bug where user id wasn't available to get_principal due to user
object not yet being flushed to database.
Now all objects are flushed on running create()
This fixes login which was broken