add function of redirect to main page when user registered successful