Elxis CMS Forum

Extensions => Modules => Topic started by: Eleanna on October 13, 2016, 17:29:45

Title: mod_login redirection after successful authentication
Post by: Eleanna on October 13, 2016, 17:29:45
Hello everybody,

I've been troubled with mod_login and I would really appreciate some help.

I want users, after successfully logging in to site, to be redirected to site's first page, instead of users central.
So, from mod_login's parameters I chose custom redirection to content:/. Nothing, authenticated users redirect to user:/.
I chose redirection to content:/category_seo. Nothing, authenticated users redirect to user:/.
I chose redirection to http://mysite.gr. Nothing, authenticated users redirect to user:/.
I then chose the other options. Still (or correctly), authenticated users redirect to user:/.

Is there any way to redirect to content:/, which is site's first page?

Btw, as far as the logout redirection, I set it also custom and worked perfectly from the very first time!

Am I missing sth?

Thanks a lot in advance!
Title: Re: mod_login redirection after successful authentication
Post by: Eleanna on October 14, 2016, 21:21:25
In case anyone is wondering, the behavior I'm describing is not happening, of course, if you login from the frontpage, since then you stay at frontpage!
What I'm saying is that if you are not at frontapge, but you are at users central and you login successfully, you stay at users central even if your choice at login module is "Custom Redirection" and Redirection URI is content:/.
The question is, should that be happening?
Title: Re: mod_login redirection after successful authentication
Post by: datahell on October 15, 2016, 18:22:58
I can't reproduce this problem. For me both login and logout re-directions work fine. I test it with frontpage (content:/) and with a custom page.

Do this:
1. Make sure you use the default Elxis login module and no other module at the same time (don't display a login module twice). If for example your template has a login module (like Chloe) use only 1 module.
2. Edit module's parameters and make sure you have the login redirection to "Custom redirection". Click save to make sure the module parameters are saved like that.
3. Make sure you have cache disabled for this module.
4. If you cant solve the problem send me a personal message with access to your site's administration to check it.
Title: Re: mod_login redirection after successful authentication
Post by: Eleanna on October 15, 2016, 20:03:21
It's interesting that you can't reproduce the problem, because I tried it at home also, at a localhost  installation and it did the same! I can't deny that probably I'm doing the same mistake over and over again but this is what I do:

1.I use default elxis login and, of course, I don't display twice the login module (I saw the message when I did it the first time  ;)) . My template is Flex, this is what we like...!
2. I choose "Custom redirection" and at the new line that opens below I write content:/
3. From the parameters of login module, at tab General, I have Cache: No (this is default, I didn't change it).
I save the module, I have a blue message "Item saved", I logout and I go to my site (local now).
Then I go to Users central to login, I choose external, e.g. gmail, and successfully authenticate. The page it reloads is Users Central...
I just did it again as I was writing now...

4. My site is locally under development!!! But, I will send you pm nonetheless!

Thanks a lot for the reply!
Title: Re: mod_login redirection after successful authentication
Post by: datahell on October 16, 2016, 08:40:35
Ooops I caught you! You go to Users Central to login, this is not the login module! This is component user login form, you cannot set redirections there. Login from the login module on the side column of the site!
Title: Re: mod_login redirection after successful authentication
Post by: Eleanna on October 16, 2016, 11:16:18
 ;D ;D
But I DO login from the right column (I have the login module at position "left" of the template)!!!!
Title: Re: mod_login redirection after successful authentication
Post by: nikos on October 16, 2016, 14:39:40
If in administration of your site at Home -> Settings to the value Default route * you set content: / and at the parameters of mod_login to the Login redirect you select "No redirection - AJAX login" and the module is published on the front page, then after successful login of a user who logins from the first page, the user remains at the front (first) page of the site.
Title: Re: mod_login redirection after successful authentication
Post by: Eleanna on October 16, 2016, 14:55:25
Nikos, thanks a lot for your reply!

Here are my details:
 a. My default route is content:/
 b. mod_login is at position "left" of template flex and published in all items (not just frontpage)
 c. if I login from the frontpage, of course I stay at frontpage (I mentioned it in earlier post - actually the 2nd one)
 d. I login (and I want to login) from the Users Central.

Maybe I shouldn't want to login from users central... :-\
But, I just mention that whatever I do, when logging in from users central (using module login located at position "left"), I stay at users central...
Title: Re: mod_login redirection after successful authentication
Post by: nikos on October 16, 2016, 15:03:42
You are welcome Eleanna to Elxis Forum

As datahell mentioned, Users Central is not the login module but a component user login form and you cannot set redirections there. You must use the Login from the login module on the side column of the site.
Title: Re: mod_login redirection after successful authentication
Post by: datahell on October 16, 2016, 19:04:17
When you login via LDAP you always get re-directed to user's central (*). The re-direction you set on the module is only for the Elxis authentication method. I sent you a personal message with a better idea (I think).

* If you want to change that do the following:
- Open file components/com_user/auth/ldap/ldap.auth.php

go to line 133 and change this:
$return = base64_encode($elxis->makeURL('user:/'));

to this:
$return = base64_encode($elxis->makeURL('content:/'));
Title: Re: mod_login redirection after successful authentication
Post by: Eleanna on October 17, 2016, 10:36:48
I should have mentioned that I was trying to authenticate with external methods...  ::)
Although the idea you suggest is, of course, better, the answer that I was looking for was the change to "authentication method".php!
Thanks a lot Datahell!!  :D