port login code from winjudge