Resolved bug where admin would need to login twice.

Also added an integration test to prove that the bug is resolved.