[Finish #50130641] Refactor front-end JavaScript -- login bug fix