Loop auth problem (temporary solution)

With ownCloud, I found a problem during login session: the client does
not receive the message authentication failed and it enters a loop
waiting for the answer authentication occurred..
This is a temporary solution: a loop counter.
After x loop, conection is closed and an error is sent.
Code clean