Skip to Content Skip to Menu

CB Login return_url

  • drijn
  • drijn
  • OFFLINE
  • Posts: 18
  • Thanks: 2
  • Karma: 0
  • Add-ons
1 week 4 days ago - 1 week 4 days ago #339759 by drijn
Hello
I used core Joomla login and its return_url parameter feature so the user can be dinamicaly redirected after login to a specific page of the site.
Now we use CB we need to change our urls

$login_url = 'index.php?option=users&view=login&return='.urlencode(base64_encode($uri_string));
to
$login_url = 'index.php?option=com_comprofiler&view=login&return='.urlencode(base64_encode($uri_string));

But redirection after cb login doesn't work.
When inspeccting the CB login view page code , the return hidden field has the homepage url as encoded value and not the return url wich is as a parameter in the current page url

Checking the code, it appears the transmitted URL is identified as NOT INTERNAL by cb login helper's getReturnUrl and Application::Router()->isInternal( $returnUrl ) Therefore it is reset as 'index.php'




What am I doing wrong?
Thank you
Last edit: 1 week 4 days ago by drijn.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48603
  • Thanks: 8300
  • Karma: 1445
1 week 4 days ago #339762 by krileon
Replied by krileon on topic CB Login return_url
Return URLs should be non-SEO and begin with index.php. Please be sure that $uri_string is formatted in such a way. Also ensure that the login redirect url in your CB Login Module is empty otherwise that will override the return value in the URL. Given it's redirecting to home page that might be set to index.php already.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • drijn
  • drijn
  • OFFLINE
  • Posts: 18
  • Thanks: 2
  • Karma: 0
  • Add-ons
1 week 4 days ago - 1 week 4 days ago #339764 by drijn
Replied by drijn on topic CB Login return_url
Hello Krileon, thanks for your quick reply.

Yes our return url is correctly encoded, non sef (the site doesn't use SEFurls) and starts with index.php...
index.php?option=com_xxxxxx&view=myproducts&Itemid=299&lang=fr

If I comment out line 107 in mod_cblogin/helper.php
//$returnUrl        =    'index.php';
it works as expected

This is because 
Application::Router()->isInternal( $returnUrl )
sees my URL as non isInternal
Wich is wrong as it obviously is an internal URL.

It seems a bug to me, but I maybe doing something wrong

here is how this is set

$app = Factory::getApplication();
if (!$app->getIdentity()->id){
            $app->enqueueMessage(Text::_('COM_LENDIO_YOU_MUST_LOGIN_FIRST'), 'warning');
            $return_url = Route::_('index.php?option=com_lendio&view=myproducts', false);
            $app->redirect(Route::_('index.php?option=com_comprofiler&view=login&return='.urlencode(base64_encode($return_url)), false));
}

This was working with com_users&view=login though

Any thought?
Last edit: 1 week 4 days ago by drijn.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48603
  • Thanks: 8300
  • Karma: 1445
1 week 4 days ago #339765 by krileon
Replied by krileon on topic CB Login return_url

sees my URL as non isInternal
Wich is wrong as it obviously is an internal URL.

This would be the real problem as Joomla itself can't determine the URL belongs to Joomla.

here is how this is set

Don't pass the return url through Route::_ before encoding and setting it. Joomla itself does not do this for return URLs as it gets passed through routing during the redirect.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
The following user(s) said Thank You: drijn

Please Log in or Create an account to join the conversation.

  • drijn
  • drijn
  • OFFLINE
  • Posts: 18
  • Thanks: 2
  • Karma: 0
  • Add-ons
1 week 4 days ago #339769 by drijn
Replied by drijn on topic CB Login return_url
That was it. Thank you
The following user(s) said Thank You: krileon

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum