Moved all login window code into the module, away from template. The
entire login window and button is now self contained in module code.