Commit 1b6fd549 authored by Romain Courteaud's avatar Romain Courteaud

[erp5_web_renderjs_ui] Reactivate automatic redirection to the login page

This redirection is specific to each application (cookie, token, erp5, another backend, etc)
parent 17ccfaaf
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
<value> <string encoding="cdata"><![CDATA[ <value> <string encoding="cdata"><![CDATA[
CACHE MANIFEST\n CACHE MANIFEST\n
# generated on Tue, 27 Oct 2015 10:23:59 +0000\n # generated on Thu, 29 Oct 2015 14:10:37 +0000\n
# XXX + fonts\n # XXX + fonts\n
# images/ajax-loader.gif\n # images/ajax-loader.gif\n
CACHE:\n CACHE:\n
...@@ -359,7 +359,7 @@ NETWORK:\n ...@@ -359,7 +359,7 @@ NETWORK:\n
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.45949.63639.28723</string> </value> <value> <string>946.49074.40798.4676</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -377,7 +377,7 @@ NETWORK:\n ...@@ -377,7 +377,7 @@ NETWORK:\n
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1445941439.32</float> <float>1446127880.43</float>
<string>UTC</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
......
...@@ -105,6 +105,17 @@ ...@@ -105,6 +105,17 @@
/*jslint indent: 2, maxerr: 3, nomen: true */\n /*jslint indent: 2, maxerr: 3, nomen: true */\n
(function (window, rJS, RSVP, UriTemplate, URI) {\n (function (window, rJS, RSVP, UriTemplate, URI) {\n
"use strict";\n "use strict";\n
\n
function wrapJioCall(gadget, method_name, argument_list) {\n
var storage = gadget.state_parameter_dict.jio_storage;\n
return storage[method_name].apply(storage, argument_list)\n
.push(undefined, function (error) {\n
if ((error.target !== undefined) && (error.target.status === 401)) {\n
// Redirect to the login view\n
return gadget.redirect({command: \'display\', options: {page: \'login\'}});\n
}\n
});\n
}\n
\n \n
rJS(window)\n rJS(window)\n
\n \n
...@@ -117,6 +128,7 @@ ...@@ -117,6 +128,7 @@
})\n })\n
\n \n
.declareAcquiredMethod(\'getSetting\', \'getSetting\')\n .declareAcquiredMethod(\'getSetting\', \'getSetting\')\n
.declareAcquiredMethod(\'redirect\', \'redirect\')\n
\n \n
.declareMethod(\'createJio\', function () {\n .declareMethod(\'createJio\', function () {\n
var gadget = this;\n var gadget = this;\n
...@@ -138,17 +150,20 @@ ...@@ -138,17 +150,20 @@
\n \n
.declareMethod(\'allDocs\', function (option_dict) {\n .declareMethod(\'allDocs\', function (option_dict) {\n
// throw new Error(\'do not use all docs\');\n // throw new Error(\'do not use all docs\');\n
var storage = this.state_parameter_dict.jio_storage;\n
\n \n
if (option_dict.list_method_template === undefined) {\n if (option_dict.list_method_template === undefined) {\n
return storage.allDocs.apply(storage, arguments);\n return wrapJioCall(this, \'allDocs\', arguments);\n
}\n }\n
return storage.getAttachment(\n return wrapJioCall(\n
// XXX Ugly hardcoded meaningless id...\n this,\n
"erp5",\n \'getAttachment\',\n
new UriTemplate.parse(option_dict.list_method_template)\n [\n
.expand(option_dict),\n // XXX Ugly hardcoded meaningless id...\n
{format: "json"}\n "erp5",\n
new UriTemplate.parse(option_dict.list_method_template)\n
.expand(option_dict),\n
{format: "json"}\n
]\n
)\n )\n
.push(function (catalog_json) {\n .push(function (catalog_json) {\n
var data = catalog_json._embedded.contents,\n var data = catalog_json._embedded.contents,\n
...@@ -176,10 +191,10 @@ ...@@ -176,10 +191,10 @@
});\n });\n
})\n })\n
.declareMethod(\'getAttachment\', function (id, name) {\n .declareMethod(\'getAttachment\', function (id, name) {\n
return this.state_parameter_dict.jio_storage.getAttachment(id, name, {format: "json"});\n return wrapJioCall(this, \'getAttachment\', [id, name, {format: "json"}]);\n
})\n })\n
.declareMethod(\'putAttachment\', function (id, name, json) {\n .declareMethod(\'putAttachment\', function (id, name, json) {\n
return this.state_parameter_dict.jio_storage.putAttachment(id, name, JSON.stringify(json));\n return wrapJioCall(this, \'putAttachment\', [id, name, JSON.stringify(json)]);\n
});\n });\n
\n \n
}(window, rJS, RSVP, UriTemplate, URI)); }(window, rJS, RSVP, UriTemplate, URI));
...@@ -305,7 +320,7 @@ ...@@ -305,7 +320,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -319,7 +334,7 @@ ...@@ -319,7 +334,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>946.24288.2744.26624</string> </value> <value> <string>946.49070.15531.48588</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -337,8 +352,8 @@ ...@@ -337,8 +352,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1444640714.39</float> <float>1446127591.78</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
...@@ -161,7 +161,7 @@ ...@@ -161,7 +161,7 @@
\n \n
document.cookie = "__ac=" + window.btoa(login + ":" + passwd);\n document.cookie = "__ac=" + window.btoa(login + ":" + passwd);\n
// XXX Hardcoded non generic redirection to the frontpage\n // XXX Hardcoded non generic redirection to the frontpage\n
return form_gadget.redirect({});\n return form_gadget.redirect({command: \'display\', options: {}});\n
});\n });\n
\n \n
});\n });\n
...@@ -286,7 +286,7 @@ ...@@ -286,7 +286,7 @@
</item> </item>
<item> <item>
<key> <string>actor</string> </key> <key> <string>actor</string> </key>
<value> <string>romain</string> </value> <value> <string>zope</string> </value>
</item> </item>
<item> <item>
<key> <string>comment</string> </key> <key> <string>comment</string> </key>
...@@ -300,7 +300,7 @@ ...@@ -300,7 +300,7 @@
</item> </item>
<item> <item>
<key> <string>serial</string> </key> <key> <string>serial</string> </key>
<value> <string>945.43780.3884.33979</string> </value> <value> <string>946.44927.40202.16725</string> </value>
</item> </item>
<item> <item>
<key> <string>state</string> </key> <key> <string>state</string> </key>
...@@ -318,8 +318,8 @@ ...@@ -318,8 +318,8 @@
</tuple> </tuple>
<state> <state>
<tuple> <tuple>
<float>1442484467.19</float> <float>1446127708.36</float>
<string>GMT</string> <string>UTC</string>
</tuple> </tuple>
</state> </state>
</object> </object>
......
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