[Fix bug 1111549] Handle race condition on user authentication.

Code based on:
https://github.com/mozilla/django-browserid/commit/357aa7933fcba7393b3b68eae721ff64dc72e2d8
Why aren't you importing this at the top of the file?