Login implemented

Returns a value in range 0 to 3 depending on result.