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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
erp5
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
Hide 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 @@
...
@@ -12,22 +12,36 @@
return
storage
[
method_name
].
apply
(
storage
,
argument_list
)
return
storage
[
method_name
].
apply
(
storage
,
argument_list
)
.
push
(
undefined
,
function
(
error
)
{
.
push
(
undefined
,
function
(
error
)
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
401
))
{
if
((
error
.
target
!==
undefined
)
&&
(
error
.
target
.
status
===
401
))
{
var
regexp
,
site
,
auth_page
;
if
(
gadget
.
state_parameter_dict
.
jio_storage_name
===
"
ERP5
"
)
{
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
"
)
{
if
(
gadget
.
state_parameter_dict
.
jio_storage_name
===
"
DAV
"
)
{
var
regexp
=
/^Nayookie login_url=
(
http
[
s
]?
:
\/\/[\/\-\[\]
{}()*+=:?&.,
\\\^
$|#
\s\w
%
]
+
)
$/
,
regexp
=
/^Nayookie login_url=
(
http
[
s
]?
:
\/\/[\/\-\[\]
{}()*+=:?&.,
\\\^
$|#
\s\w
%
]
+
)
$/
;
auth_page
=
error
.
target
.
getResponseHeader
(
'
WWW-Authenticate
'
),
auth_page
=
error
.
target
.
getResponseHeader
(
'
WWW-Authenticate
'
);
site
;
if
(
regexp
.
test
(
auth_page
))
{
if
(
regexp
.
test
(
auth_page
))
{
site
=
UriTemplate
.
parse
(
site
=
UriTemplate
.
parse
(
regexp
.
exec
(
auth_page
)[
1
]
regexp
.
exec
(
auth_page
)[
1
]
).
expand
({
back_url
:
window
.
location
.
href
,
).
expand
({
origin
:
window
.
location
.
protocol
+
'
//
'
+
back_url
:
window
.
location
.
href
,
window
.
location
.
host
});
origin
:
window
.
location
.
origin
,
return
gadget
.
redirect
({
toExternal
:
true
,
url
:
site
});
});
}
}
}
}
if
(
site
)
{
return
gadget
.
redirect
({
toExternal
:
true
,
url
:
site
});
}
}
}
throw
error
;
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