issue 1253 - prevent multiple logins with same username

Resolves #1253 
Please add a doxy-comment explaining what the function does, what the return values mean etc.