Refactor code, fix bug that error message is still shown when going back to enroll page from enroll result page
[Fixes #72581816] Update required changes, fix a found bug