Checked the code and fixed the continuous redirect issue