Added event waiting to backend login function