We have a customer that uses multiple templates and multiple languages in his Joomla 2.5 website, Happens that in some specifical situations like when a user tries to login with wrong credentials or clicks in "forgot password" the template switches to the default. We debugged some code in com_users component and found out that the url is redirecting without passing the ItemId. Thats when the template switching occurs. The file path is pasted below and the line in which we have issue is the line 66
{root}/components/com_users/controllers/user.php line number: 66.
example:
In login page when user entered wrong credentials from the template2, it is redirecting to the template1(default template).
The redirection code is in [{root}/components/com_users/controllers/user.php line number: 66]. Even though it is the joomla built-in component, joomla is not passing Itemid in JRoute. So joomla library assigning same itemid for both the templates while generating sef urls then template switching happen.
These are problems we are facing, please suggest the solution to overcome this type of scenarios.