Skip to Content Skip to Menu

🌟 CB Editor Assistant 1.0.0 is here! Discover our new AI Joomla Plugin that wrote its story! (and this banner!)
Start at just $12.50/month* or 💸 save 30% with our 🛍️ Intro Black Friday Offer for a lifetime*

Auto login from cookie using auto action

4 years 8 months ago - 4 years 8 months ago #316999 by smalldragoon
Auto login from cookie using auto action was created by smalldragoon
Hi,
To give context first, I have an external auth system which creates a session cookie with the JWT when auth . is succeesfull. cookie created is JWT , in /
I would like to trigger an autoaction to automatically login the user into joomla, when he is NOT already.
To do so, I have created the following :

trigger : joomla_on AfterRoute ( all the time , I will reduce the scope later )
conditions ( see attached screenshot ):
- when the session cookie JWT is not empty
- when the session cookie "joomla_user_state" is existing , meaning no joomla user is logged-in

I tried several options for "joomla_user_state" as syntax :

- [cookie_joomla_user_state]
- [cookie_JOOMLA_USER_STATE]

and several operators ( equal to -> logged_in , contains -> log ..etc ...)

but nothing is working. as [cookie_JWT] is working, I don't get why it is not for this other cookie

anything I'm missing ?
thanks
Attachments:
Last edit: 4 years 8 months ago by krileon. Reason: edited title to be more descriptive

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 8 months ago #317006 by krileon
Replied by krileon on topic Auto login from cookie using auto action
What you're describing is the exact purpose of "Remember Me". Have your users check that checkbox during login or configure your CB Login Module to have it checked by default if you want it applying to everyone initially. The remember me cookie will cause Joomla to log them back in if their session expires.


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.

4 years 8 months ago #317020 by smalldragoon
Replied by smalldragoon on topic Auto login from cookie using auto action
HI, I was not clear apparently, but with other tests I discovered the issue :

I want to make a condition on the fact that a cookie named "JWT" exist ( or not )
I made some test : if I create an empty cookie, and use of course the empty criteria it works.

How can I define then the condition " if a [cookie_JWT] exists ?
Thanks

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 8 months ago #317029 by krileon
Replied by krileon on topic Auto login from cookie using auto action
If the cookie doesn't exist then the parser that's parsing additional substitutions doesn't know it exists either. This means [cookie_JWT] will output literally as [cookie_JWT]. The Code condition is probably the best way to handles this. Example as follows.

Field: Custom > Code
Custom Code:
Code:
return ( isset( $_COOKIE['JWT'] ) ? $_COOKIE['JWT'] : null );
Operator: Not Empty

That should work how you're expecting.


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: smalldragoon

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

4 years 8 months ago #317059 by smalldragoon
Replied by smalldragoon on topic Auto login from cookie using auto action
Perfect thx !
Should i suggest a feature request to have a new operator available ?

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48551
  • Thanks: 8291
  • Karma: 1445
4 years 8 months ago #317071 by krileon
Replied by krileon on topic Auto login from cookie using auto action
There's no operator that could handle that case. Substitutions that don't exist are just as-is strings. The code condition helps cover those extra cases where the substitution may not exist.


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: smalldragoon

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

Moderators: beatnantkrileon
Powered by Kunena Forum