bug 1072493 - Make login function much simpler