Refactor the if conditional on show password JS