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

Code based on:
https://github.com/mozilla/django-browserid/commit/357aa7933fcba7393b3b68eae721ff64dc72e2d8
Merge pull request #1133 from johngian/1111549

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