J4 Issue ?
avatar brianteeman
brianteeman
26 Aug 2019

It is not possible to login to the admin of Joomla if you do not have cookies enabled in your browser.

That is fine.

The problem is that if you do not have cookies enabled and try to login nothing happens. The only clue that there is a problem is that you have a browser generated icon in the url bar.

Obviously it would be much better if there was a check that cookies were enabled. From what I can tell we do have a check in the installer for this

so maybe someone can use that as an example to improve the admin login experience

avatar brianteeman brianteeman - open - 26 Aug 2019
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Aug 2019
avatar mbabker
mbabker - comment - 27 Aug 2019

isNew() only checks if the session is brand new (basically you're still in the same request that creates the session and nothing got tricky and did a $session->close() then $session->start() in the request). It works in that context because it is the first AJAX step in the install chain so by the time you trigger the action you should have a session already going, and if you don't have one that was started before that request then you've probably direct requested that specific task without going through the app properly (if the controllers did proper request method checks, then that controller should be checking it's not a GET request before checking anything about the session, and you could probably avoid the flaky session check altogether without a properly dedicated task).

AFAIK, the only way to actually check if cookies are enabled is to basically try writing one (which creating a session will do by default), do a redirect to something, and check if the cookie you just wrote exists. You can't really pull that off well in the install or admin apps with an overly generic check like the one in the controller you highlighted.

avatar brianteeman
brianteeman - comment - 27 Aug 2019

ok - thanks for the detailed explanation why my suggested code was poop.

I dont care how its done but we should do something

avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Aug 2019
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 27 Aug 2019
Labels Added: J4 Issue
avatar franz-wohlkoenig franz-wohlkoenig - labeled - 27 Aug 2019
avatar mbabker
mbabker - comment - 27 Aug 2019

I dont care how its done but we should do something

Realistically, you can kind of use that same check in the LanguageController if you pop off AJAX tasks on page load once the admin login screen or the install app is loaded, and maybe the frontend com_users login view (but not the module IMO, that would force an AJAX request on every page the module renders on). Since the only way isNew() should return true in that context is if those AJAX paths are direct accessed, the check would be a step up over what's there now (do nothing), but I don't know if you could rely on that as a 100% foolproof thing.

So you're on the right track, but to me that seems a bit flaky at best.

avatar brianteeman brianteeman - change - 6 Sep 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-09-06 13:37:18
Closed_By brianteeman
avatar brianteeman brianteeman - close - 6 Sep 2019

Add a Comment

Login with GitHub to post a comment