Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XWIKI-22205: Underline inline link in CSRF confirmation Panel #3200

Merged
merged 6 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3640,7 +3640,7 @@ XWiki.SearchSuggestSourceClass_activated=Activated
XWiki.SearchSuggestSourceClass_activated.hint=Whether this source is used or not (as long as the source search engine matches the search engine used by the current wiki).

### CSRFToken resources
csrf.confirmation=<p>This request contains an invalid authentication information.</p><p>This might happen in the following situations:</p><ul><li>You left the editor open in another window/tab and logged off and on again</li><li>Your authentication token expired after a long period of inactivity</li><li>Somebody tried to perform a CSRF attack</li></ul><p>If you are sure that none of these situations apply in your case, you might have found a bug. We are sorry about that, please report it on <a href="http://jira.xwiki.org/">XWiki JIRA</a></p><p>Do you want to resend the request? If unsure, say <strong>No</strong>.</p>
csrf.confirmation={0}This request contains an invalid authentication information.{1}{2}This might happen in the following situations:{3}{4}You left the editor open in another window/tab and logged off and on again{5}{6}Your authentication token expired after a long period of inactivity{7}{8}Somebody tried to perform a CSRF attack{9}{10}If you are sure that none of these situations apply in your case, you might have found a bug. We are sorry about that, please report it on {11}XWiki JIRA{12}{13}Do you want to resend the request? If unsure, say {14}No{15}.{16}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@surli Does this solution look good to you?
Technically we're breaking backward compatibility on this translation key (the number of parameters was changed). Should I deprecate this exact key and introduce a new one with the correct amount of parameters?

Since updating all the translations will take a bit of time, I want to make sure we're on the same line before doing it :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should I deprecate this exact key and introduce a new one with the correct amount of parameters?

Yes you should do that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we could also decide to split this translation in multiple keys: e.g. one key for the message title, one for a description, one for details. Might be more clean.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did split this translation in multiple parts according to your comment 👍
I'm not 100% certain on how to name those parts, we might need to change this before a merge.
See my message below for a view of the manual tests I just made to make sure I didn't break the templates with these updates.


### Extension Manager application resources
admin.extensions=Extension Manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,18 @@ $response.addHeader( "X-FRAME-OPTIONS", "DENY" )
<div class="main layoutsubsection">
## Set as an HTML main for better DOM tree semantics to facilitate navigation with assistive technologies.
<main id="mainContentArea">
#xwikimessageboxstart($services.localization.render('warning') $services.localization.render('csrf.confirmation'))
#xwikimessageboxstart($services.localization.render('warning') $services.localization.render('csrf.confirmation', [
'<p>', '</p>',
'<p>', '</p>',
'<ul><li>', '</li>',
'<li>', '</li>',
'<li>', '</li></ul>',
'<p class="force-underline">',
'<a href="http://jira.xwiki.org/">', '</a></p>',
'<p>', '<strong>',
'</strong>', '</p>'
]))
coucou
#getSanitizedURLAttributeValue('form','action', $request.getParameter('resubmit'), '', $resubmit)
#getSanitizedURLAttributeValue('a','href', $request.getParameter('xback'), $doc.getURL(), $xback)
<form action="$resubmit" method="post">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,10 @@ var XWiki = (function(XWiki) {
var buttonsDiv = new Element('div');

// the confirmation message contains some double quotes that should be escaped.
content.insert("$escapetool.json($services.localization.render('csrf.confirmation'))");
content.insert("$escapetool.json($services.localization.render('csrf.confirmation', [
'<p>', '</p>', '<p>', '</p>', '<ul><li>', '</li>', '<li>', '</li>', '<li>', '</li></ul>',
'<p class="force-underline">', '<a href="http://jira.xwiki.org/">', '</a></p>', '<p>', '<strong>',
'</strong>', '</p>' ]))");
content.insert(new Element('br'));
var buttonCreate = new Element('button', {'class': 'btn btn-default', 'id': 'force-save-csrf'});
buttonCreate.insert("$services.localization.render('yes')");
Expand Down