Dnn.Platform icon indicating copy to clipboard operation
Dnn.Platform copied to clipboard

Make Cookie Consent Url localizable

Open MaiklT opened this issue 3 years ago • 24 comments

Description of problem

On a multi lingual portal it is not possible to enter different Cookie Consent Urls for each language (e.g. https://en.wikipedia.org/wiki/HTTP_cookie for English, https://de.wikipedia.org/wiki/HTTP-Cookie for German, https://fr.wikipedia.org/wiki/Cookie_(informatique) for French etc.).

Description of solution

This setting should be dependant from the language.

MaiklT avatar Nov 25 '20 09:11 MaiklT

Hmmm... Currently, this setting saves to the PortalSettings table. I guess this would mean moving it to PortalLocalization table as a new column since there isn't a localized table for portal settings.

In the specific example of Wikipedia, doesn't it detect and redirect based on browser locale?

WillStrohl avatar Nov 25 '20 16:11 WillStrohl

@hismightiness PortalSettings support localization (since I added to in DNN 7)

sleupold avatar Nov 25 '20 16:11 sleupold

Oh, I missed the CultureCode column. I guess that means this is already a localized setting, right?

WillStrohl avatar Nov 25 '20 17:11 WillStrohl

yes

sleupold avatar Nov 25 '20 17:11 sleupold

Now I'm confused. 🤔😀

WillStrohl avatar Nov 25 '20 17:11 WillStrohl

sorry, I meant PortalSettings table supports localization, but for CookieConsent URL, it needs to be wired to the UI.

sleupold avatar Nov 25 '20 19:11 sleupold

But that URL is saved to the PortalSettings table. I guess I'm missing something. :)

WillStrohl avatar Nov 25 '20 19:11 WillStrohl

when saving a site setting in PortalSettings table, you may save it localized or "neutral". In this case, it needs to be change from "neutral" to "localized", allowing diferent URLs per laguage.

sleupold avatar Nov 25 '20 20:11 sleupold

Ah... I didn't check the specific line of code that saves the URL.

WillStrohl avatar Nov 25 '20 20:11 WillStrohl

Well, from a quick look at it every time you change it for any language, it saves the new (same) value for all languages:

image

Editing the values in the database appears to work though, so I guess the reading part is fine but we have something wrong in the writing (or maybe modifying part) of the code. it probably modifies all the existing ones instead of just the existing ones that match the currently selected language in the PersonaBar...

valadas avatar Nov 25 '20 21:11 valadas

@valadas
this behavior is by design, if update is executed without providing a locale - with a locale provided, only value for this language will be updated.

sleupold avatar Nov 25 '20 23:11 sleupold

@hismightiness:

In the specific example of Wikipedia, doesn't it detect and redirect based on browser locale?

No.

@sleupold, @valadas, @hismightiness:

I tried to add the records in the database (and restarted the AppPool):

CookieMoreLink

This works - not really... :-(

To reproduce: Goto https://www.kaisermaximilianpreis.at.

Click on the link ("Mehr erfahren") - you come to the German Wikipedia Page. Close this page.

Click on "ENG" (top right), then click "Learn more". Again, you come to the German Wikipedia page. Close this page.

Refresh the page. Click "Learn more" again. You come to the English Wikipedia page. Close this page.

Click on "FRA". Click "Apprendre encore plus" - guess what opens. It is the English page again. Close it.

Refresh the page. Click "Apprendre encore plus" again, the French Wikipedia Page opens.

And so on...

???

MaiklT avatar Nov 26 '20 16:11 MaiklT

@valadas this behavior is by design, if update is executed without providing a locale - with a locale provided, only value for this language will be updated.

It's not by design, when updating for one language it updates all languages to that value. Something is wrong somewhere. I tdoes read each language value properly but when saving it updates them all to the same value. This is wrong.

valadas avatar Nov 26 '20 17:11 valadas

FYI - In general, making an update directly to the database for something like this may not be a true representation of the issue and how to reproduce it so someone can potentially fix it (or even that is does/doesn't work). I know everyone here so far knows that, so this comment is mostly for anyone else watching. :)

WillStrohl avatar Nov 26 '20 19:11 WillStrohl

FYI - In general, making an update directly to the database for something like this may not be a true representation of the issue and how to reproduce it so someone can potentially fix it (or even that is does/doesn't work). I know everyone here so far knows that, so this comment is mostly for anyone else watching. :)

Correct, I was mainly pointing out that after testing this, the logic is fine but the saving is wrong, it updates all languages with the same value no mater which language you are attempting to edit. It is a workaround at least to adjust those existing entries until someone picks up on this issue.

valadas avatar Nov 26 '20 21:11 valadas

sorry, I misread your statement. the logic should be:

  • when updating without providing a CultureCode > update all values (or delete all language specific values and update/create just a neutral one
  • when updating providing a CultureCode > update value for this language or create a record, if not exists.

sleupold avatar Nov 26 '20 23:11 sleupold

Correct

valadas avatar Nov 26 '20 23:11 valadas

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

stale[bot] avatar Mar 05 '21 17:03 stale[bot]

AFAIK still an issue. Anyone willing to contribute a PR?

sleupold avatar Mar 05 '21 17:03 sleupold

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

stale[bot] avatar Jun 03 '21 19:06 stale[bot]

Still relevant.

WillStrohl avatar Jun 03 '21 20:06 WillStrohl

We have detected this issue has not had any activity during the last 90 days. That could mean this issue is no longer relevant and/or nobody has found the necessary time to address the issue. We are trying to keep the list of open issues limited to those issues that are relevant to the majority and to close the ones that have become 'stale' (inactive). If no further activity is detected within the next 14 days, the issue will be closed automatically. If new comments are are posted and/or a solution (pull request) is submitted for review that references this issue, the issue will not be closed. Closed issues can be reopened at any time in the future. Please remember those participating in this open source project are volunteers trying to help others and creating a better DNN Platform for all. Thank you for your continued involvement and contributions!

stale[bot] avatar Sep 03 '21 01:09 stale[bot]

Still relevant.

WillStrohl avatar Sep 03 '21 15:09 WillStrohl

I triaged this, the fix should be pretty similar to https://github.com/dnnsoftware/Dnn.Platform/pull/4851/commits/636f7310355865c5d6715d04562c6d00b15595a3

Basically, we need to read and write using an API that we can provide with the culture code from the request and not let DNN find it from the alias. The alias might not be the language selected for which we want to set the setting.

valadas avatar Oct 04 '21 03:10 valadas