Used returned value in initiateLogin instead of a new global variable