Commit 99066fb2 authored by Vincent Pelletier's avatar Vincent Pelletier

all: Ignore language when checking if URL is prefixed by WebSite's url

Otherwise
  https://example.com/foo
would match
  https://example.com/
but not the language-selector
  https://example.com/en/
parent b70c1c62
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
came_from python: request.get('came_from') or request.get('field_came_from'); came_from python: request.get('came_from') or request.get('field_came_from');
isAnon here/portal_membership/isAnonymousUser | nothing; isAnon here/portal_membership/isAnonymousUser | nothing;
url_topmost_document python: here.Base_getURLTopmostDocumentValue(); url_topmost_document python: here.Base_getURLTopmostDocumentValue();
came_from_valid python: not came_from or url_topmost_document.isURLAncestorOf(came_from);"> came_from_valid python: not came_from or url_topmost_document.getOriginalDocument().isURLAncestorOf(came_from);">
<tal:block tal:condition="isAnon"> <tal:block tal:condition="isAnon">
<tal:block tal:define="dummy python: response.expireCookie('__ac', path='/'); <tal:block tal:define="dummy python: response.expireCookie('__ac', path='/');
url python: '%s/login_form?portal_status_message=%s' % (here.absolute_url(), here.Base_translateString('Login and/or password is incorrect.')); url python: '%s/login_form?portal_status_message=%s' % (here.absolute_url(), here.Base_translateString('Login and/or password is incorrect.'));
......
topmost_url_document = context.Base_getURLTopmostDocumentValue() topmost_url_document = context.Base_getURLTopmostDocumentValue()
if not topmost_url_document.isURLAncestorOf(cancel_url): if not topmost_url_document.getOriginalDocument().isURLAncestorOf(cancel_url):
return context.ERP5Site_redirect(topmost_url_document.absolute_url(), return context.ERP5Site_redirect(topmost_url_document.absolute_url(),
keep_items={'portal_status_message': 'Redirection to an external site prevented.'}, keep_items={'portal_status_message': 'Redirection to an external site prevented.'},
**kw) **kw)
......
...@@ -40,7 +40,7 @@ if REQUEST.get('is_user_account_password_expired_expire_date'): ...@@ -40,7 +40,7 @@ if REQUEST.get('is_user_account_password_expired_expire_date'):
hour_minute=1)})}) hour_minute=1)})})
topmost_url_document = context.Base_getURLTopmostDocumentValue() topmost_url_document = context.Base_getURLTopmostDocumentValue()
if not topmost_url_document.isURLAncestorOf(url): if not topmost_url_document.getOriginalDocument().isURLAncestorOf(url):
return topmost_url_document.Base_redirect( return topmost_url_document.Base_redirect(
keep_items={ keep_items={
'portal_status_message': translateString('Redirection to an external site prevented.'), 'portal_status_message': translateString('Redirection to an external site prevented.'),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment