Skip to content

[6.2] Implement secure article preview without requiring frontend login - #48030

Open
joomdonation wants to merge 11 commits into
joomla:6.2-devfrom
joomdonation:article_preview_improvement
Open

[6.2] Implement secure article preview without requiring frontend login#48030
joomdonation wants to merge 11 commits into
joomla:6.2-devfrom
joomdonation:article_preview_improvement

Conversation

@joomdonation

Copy link
Copy Markdown
Contributor

Pull Request resolves # .

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

Summary of Changes

This is alternative to #47569. The purpose is allow secure preview (unpublished/un-accessible) articles without requiring login from frontend of the site using an account with certain permissions.

Testing Instructions

  • Uses Joomla 6.2
  • Make sure you are not logged in in frontend of your site.
  • Login to backend of your site, edit an article
  • Try to use Preview button to see preview the article. Make sure you can preview the article, even if the article is unpublished or have Access set to certain access level different with Public.

Actual result BEFORE applying this Pull Request

Preview article requires user to login in frontend of the site and have certain permissions.

Expected result AFTER applying this Pull Request

Preview article does not require user to login from frontend. Secure mechanism is implemented using a secure, time-based token to make sure users can only preview article by accessing to the link generated by Preview button in the backend. And the preview link will be expired after the time configured in Preview Token Expiration (hours) parameter in com_content Options.

Additional Information

The code for creating and validating preview token in administrator/components/com_content/src/Helper/PreviewTokenHelper.php is not coded by hand. The JSON data structure, the validation, encode, decode... implements in the class comes from discussion with AI, and by looking at sample code from a JWT library. I have read and verify the accurate of the code, but if the implementation is accepted, I will ask for help from David Jardin for additional security review.

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

@joomla-cms-bot joomla-cms-bot added Language Change This is for Translators PR-6.2-dev labels Jun 27, 2026
@brianteeman

brianteeman commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

I would prefer to see the preview measured in minutes and not hours. Maybe 15 minutes as a default and then steps of 5.

It all depends if the intent of this feature is to give the content creator a working preview or if this is something you want to share. For me it's the former so there is no need for a long preview time. Even 5 minutes would be enough

@joomdonation

Copy link
Copy Markdown
Contributor Author

I can change that. But I think minutes might be a bit low. It is OK for the author to preview but if you want to share the preview URL to someone else not near you, hours would be better.

@joomdonation

Copy link
Copy Markdown
Contributor Author

And the URL is protected by a secure token, so having it valid for longer (for example, one hour) would not cause any issue. But Yes, the token expiration time is something I would like to have feedback from you others.

@brianteeman

Copy link
Copy Markdown
Contributor

If the feature is intended for the URL to be shared then I would add some sharing functionality (that's what @roland-d did iirc) but for me I've always seen this as for the content authors use primarily and even 15 minutes would be 14 m8nutes longer than required

@joomdonation

Copy link
Copy Markdown
Contributor Author

OK, thanks. I changed token expiration times to minutes with default value and step as suggested.

@brianteeman

Copy link
Copy Markdown
Contributor

Thanks 👍

Comment thread administrator/language/en-GB/com_content.ini Outdated
Comment thread administrator/language/en-GB/com_content.ini Outdated
@QuyTon

QuyTon commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on f10e870


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48030.

1 similar comment
@CSGoat0

CSGoat0 commented Jun 30, 2026

Copy link
Copy Markdown
Member

I have tested this item ✅ successfully on f10e870


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48030.

@QuyTon

QuyTon commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48030.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Jun 30, 2026
Comment thread administrator/components/com_content/src/Service/PreviewTokenService.php Outdated
@brianteeman

Copy link
Copy Markdown
Contributor

I have tested this item ✅ successfully on 9b7ed8a


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/48030.

@brianteeman

Copy link
Copy Markdown
Contributor

@MacJoom this would be a really big feautre for 6.2

@MacJoom MacJoom added this to the Joomla! 6.2.0 milestone Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Language Change This is for Translators PR-6.2-dev RTC This Pull Request is Ready To Commit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants