[login captcha] fix js bug & improved code