Bug fix in login javascript