Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Gambier
erp5
Commits
3e36d70a
Commit
3e36d70a
authored
May 06, 2022
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
Fix "Go back' on login
See merge request
nexedi/erp5!1616
parents
628ab4b4
3ffd3418
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
85 additions
and
12 deletions
+85
-12
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderCameFromURITemplate.py
...5_web_renderjs_ui/WebSection_renderCameFromURITemplate.py
+17
-0
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderCameFromURITemplate.xml
..._web_renderjs_ui/WebSection_renderCameFromURITemplate.xml
+62
-0
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSite_login.py
...teItem/portal_skins/erp5_web_renderjs_ui/WebSite_login.py
+1
-11
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/login_form.zpt
...lateItem/portal_skins/erp5_web_renderjs_ui/login_form.zpt
+5
-1
No files found.
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderCameFromURITemplate.py
0 → 100644
View file @
3e36d70a
import
re
from
ZTUtils
import
make_query
portal
=
context
.
getPortalObject
()
# XXX Hardcoded behaviour for JS app.
# Expect came_from to be an URL template
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
url_parameter
=
"n.me"
pattern
=
'{[&|?]%s}'
%
url_parameter
if
(
person
is
None
or
not
portal
.
portal_membership
.
checkPermission
(
'View'
,
person
)):
came_from
=
re
.
sub
(
pattern
,
''
,
came_from
)
else
:
prefix
=
"&"
if
"&%s"
%
url_parameter
in
came_from
else
"?"
came_from
=
re
.
sub
(
pattern
,
'%s%s'
%
(
prefix
,
make_query
({
url_parameter
:
person
.
getRelativeUrl
()})),
came_from
)
return
came_from
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSection_renderCameFromURITemplate.xml
0 → 100644
View file @
3e36d70a
<?xml version="1.0"?>
<ZopeData>
<record
id=
"1"
aka=
"AAAAAAAAAAE="
>
<pickle>
<global
name=
"PythonScript"
module=
"Products.PythonScripts.PythonScript"
/>
</pickle>
<pickle>
<dictionary>
<item>
<key>
<string>
Script_magic
</string>
</key>
<value>
<int>
3
</int>
</value>
</item>
<item>
<key>
<string>
_bind_names
</string>
</key>
<value>
<object>
<klass>
<global
name=
"NameAssignments"
module=
"Shared.DC.Scripts.Bindings"
/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key>
<string>
_asgns
</string>
</key>
<value>
<dictionary>
<item>
<key>
<string>
name_container
</string>
</key>
<value>
<string>
container
</string>
</value>
</item>
<item>
<key>
<string>
name_context
</string>
</key>
<value>
<string>
context
</string>
</value>
</item>
<item>
<key>
<string>
name_m_self
</string>
</key>
<value>
<string>
script
</string>
</value>
</item>
<item>
<key>
<string>
name_subpath
</string>
</key>
<value>
<string>
traverse_subpath
</string>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key>
<string>
_params
</string>
</key>
<value>
<string>
came_from
</string>
</value>
</item>
<item>
<key>
<string>
id
</string>
</key>
<value>
<string>
WebSection_renderCameFromURITemplate
</string>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/WebSite_login.py
View file @
3e36d70a
import
re
REQUEST
=
context
.
REQUEST
RESPONSE
=
REQUEST
.
RESPONSE
from
ZTUtils
import
make_query
...
...
@@ -35,16 +34,7 @@ else:
# XXX How to warn user that password will expire?
# is_user_account_password_expired_expire_date = REQUEST.get('is_user_account_password_expired_expire_date', 0)
# XXX Hardcoded behaviour for JS app.
# Expect came_from to be an URL template
person
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
url_parameter
=
"n.me"
pattern
=
'{[&|?]%s}'
%
url_parameter
if
(
person
is
None
or
not
portal
.
portal_membership
.
checkPermission
(
'View'
,
person
)):
came_from
=
re
.
sub
(
pattern
,
''
,
came_from
)
else
:
prefix
=
"&"
if
"&%s"
%
url_parameter
in
came_from
else
"?"
came_from
=
re
.
sub
(
pattern
,
'%s%s'
%
(
prefix
,
make_query
({
url_parameter
:
person
.
getRelativeUrl
()})),
came_from
)
came_from
=
context
.
WebSection_renderCameFromURITemplate
(
came_from
)
# RESPONSE.redirect(came_from or context.getPermanentURL(context));
RESPONSE
.
setHeader
(
'Location'
,
came_from
or
context
.
getPermanentURL
(
context
))
RESPONSE
.
setStatus
(
303
)
bt5/erp5_web_renderjs_ui/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui/login_form.zpt
View file @
3e36d70a
...
...
@@ -40,7 +40,7 @@
<section
tal:condition=
"not: portal/portal_membership/isAnonymousUser"
>
<p
i18n:domain=
"ui"
i18n:translate=
""
>
It seems you're already authenticated.
</p>
<p><a
tal:condition=
"exists: request/came_from"
tal:attributes=
"href
request/came_from
"
>
Go back
</a></p>
tal:attributes=
"href
python:context.WebSection_renderCameFromURITemplate(request.came_from)
"
>
Go back
</a></p>
</section>
<section
tal:condition=
"portal/portal_membership/isAnonymousUser"
>
...
...
@@ -81,6 +81,8 @@
<a
tal:attributes=
"href string:${current_url}/ERP5Site_redirectToFacebookLoginPage"
i18n:translate=
""
i18n:domain=
"ui"
class=
"sign_in_with_facebook"
>
<img
alt=
"Login with Facebook"
src=
"facebook_login_button.png"
>
</a>
...
...
@@ -90,6 +92,8 @@
<a
tal:attributes=
"href string:${current_url}/ERP5Site_redirectToOpenIdLoginPage"
i18n:translate=
""
i18n:domain=
"ui"
class=
"sign_in_with_openid"
>
<img
alt=
"Sign in with OpenID Connect"
src=
"openid_login_button.png"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment