Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
Hamza
erp5-Boxiang
Commits
9fc4ddfd
Commit
9fc4ddfd
authored
Oct 14, 2016
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_officejs: Handle ERP5 redirection when getting 401 code in a jIO request
parent
6b85d617
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
8 deletions
+22
-8
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.js
...athTemplateItem/web_page_module/gadget_officejs_jio_js.js
+22
-8
No files found.
bt5/erp5_officejs/PathTemplateItem/web_page_module/gadget_officejs_jio_js.js
View file @
9fc4ddfd
...
...
@@ -12,22 +12,36 @@
return
storage
[
method_name
].
apply
(
storage
,
argument_list
)
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
401
))
{
var
regexp
,
site
,
auth_page
;
if
(
gadget
.
state_parameter_dict
.
jio_storage_name
===
"
ERP5
"
)
{
return
gadget
.
redirect
({
page
:
"
login
"
});
regexp
=
/^X-Delegate uri=
\"(
http
[
s
]?
:
\/\/[\/\-\[\]
{}()*+=:?&.,
\\\^
$|#
\s\w
%
]
+
)\"
$/
;
auth_page
=
error
.
target
.
getResponseHeader
(
'
WWW-Authenticate
'
);
if
(
regexp
.
test
(
auth_page
))
{
site
=
UriTemplate
.
parse
(
regexp
.
exec
(
auth_page
)[
1
]
).
expand
({
came_from
:
window
.
location
.
href
,
cors_origin
:
window
.
location
.
origin
,
});
}
}
if
(
gadget
.
state_parameter_dict
.
jio_storage_name
===
"
DAV
"
)
{
var
regexp
=
/^Nayookie login_url=
(
http
[
s
]?
:
\/\/[\/\-\[\]
{}()*+=:?&.,
\\\^
$|#
\s\w
%
]
+
)
$/
,
auth_page
=
error
.
target
.
getResponseHeader
(
'
WWW-Authenticate
'
),
site
;
regexp
=
/^Nayookie login_url=
(
http
[
s
]?
:
\/\/[\/\-\[\]
{}()*+=:?&.,
\\\^
$|#
\s\w
%
]
+
)
$/
;
auth_page
=
error
.
target
.
getResponseHeader
(
'
WWW-Authenticate
'
);
if
(
regexp
.
test
(
auth_page
))
{
site
=
UriTemplate
.
parse
(
regexp
.
exec
(
auth_page
)[
1
]
).
expand
({
back_url
:
window
.
location
.
href
,
origin
:
window
.
location
.
protocol
+
'
//
'
+
window
.
location
.
host
});
return
gadget
.
redirect
({
toExternal
:
true
,
url
:
site
});
).
expand
({
back_url
:
window
.
location
.
href
,
origin
:
window
.
location
.
origin
,
});
}
}
if
(
site
)
{
return
gadget
.
redirect
({
toExternal
:
true
,
url
:
site
});
}
}
throw
error
;
});
...
...
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