implement login logic by javascript