Fix issues #823, Fix login when anonymous mode is enable.

Fix provides by Martin Mohring, mmohring.