From c3d2924623350fee9ed6f1e6d055921e921b7e00 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Sat, 18 Jan 2014 17:36:28 +0100 Subject: [PATCH] [ADD] auth_from_http_basic_logout --- auth_from_http_basic_logout/__init__.py | 20 +++++++ auth_from_http_basic_logout/__openerp__.py | 52 ++++++++++++++++++ .../i18n/auth_from_http_basic_logout.pot | 23 ++++++++ auth_from_http_basic_logout/i18n/nl.po | 23 ++++++++ .../static/src/img/icon.png | Bin 0 -> 1142 bytes .../src/js/auth_from_http_basic_logout.js | 48 ++++++++++++++++ 6 files changed, 166 insertions(+) create mode 100644 auth_from_http_basic_logout/__init__.py create mode 100644 auth_from_http_basic_logout/__openerp__.py create mode 100644 auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot create mode 100644 auth_from_http_basic_logout/i18n/nl.po create mode 100644 auth_from_http_basic_logout/static/src/img/icon.png create mode 100644 auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js diff --git a/auth_from_http_basic_logout/__init__.py b/auth_from_http_basic_logout/__init__.py new file mode 100644 index 000000000..9dd152f93 --- /dev/null +++ b/auth_from_http_basic_logout/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## diff --git a/auth_from_http_basic_logout/__openerp__.py b/auth_from_http_basic_logout/__openerp__.py new file mode 100644 index 000000000..7f7b4812e --- /dev/null +++ b/auth_from_http_basic_logout/__openerp__.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# This module copyright (C) 2014 Therp BV (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . +# +############################################################################## +{ + "name" : "Authenticate via HTTP basic authentication (logout helper)", + "version" : "1.0", + "author" : "Therp BV", + "complexity": "expert", + "description": """ +With auth_from_http_basic, the logout procedure has to be bent a bit to provide +a good user experience. As the former has to be a server wide module, this is +the clientside complement which provides the javascript part. + +The addon has to be installed in the database in use. + """, + "category" : "", + "depends" : [ + 'web', + 'auth_from_http_basic', + ], + "data" : [ + ], + "js": [ + 'static/src/js/auth_from_http_basic_logout.js', + ], + "css": [ + ], + "qweb": [ + ], + "auto_install": False, + "installable": True, + "external_dependencies" : { + 'python' : [], + }, +} diff --git a/auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot b/auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot new file mode 100644 index 000000000..5b21a40f1 --- /dev/null +++ b/auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot @@ -0,0 +1,23 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-18 16:31+0000\n" +"PO-Revision-Date: 2014-01-18 16:31+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: auth_from_http_basic_logout +#. openerp-web +#: code:addons/auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js:37 +#, python-format +msgid "

You have been logged out successfully. Click here to log in again.

" +msgstr "" + diff --git a/auth_from_http_basic_logout/i18n/nl.po b/auth_from_http_basic_logout/i18n/nl.po new file mode 100644 index 000000000..6f40c46a9 --- /dev/null +++ b/auth_from_http_basic_logout/i18n/nl.po @@ -0,0 +1,23 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2014-01-18 16:31+0000\n" +"PO-Revision-Date: 2014-01-18 16:31+0000\n" +"Last-Translator: <>\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: \n" + +#. module: auth_from_http_basic_logout +#. openerp-web +#: code:addons/auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js:37 +#, python-format +msgid "

You have been logged out successfully. Click here to log in again.

" +msgstr "

U bent afgemeld. Klik hier om weer in te loggen.

" + diff --git a/auth_from_http_basic_logout/static/src/img/icon.png b/auth_from_http_basic_logout/static/src/img/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..4c7ab302908e114888446d84d3493fa726033c1f GIT binary patch literal 1142 zcmeAS@N?(olHy`uVBq!ia0vp^0U*r53?z4+XPOVBSkfJR9T^xl_H+M9WCijWi-X*q z7}lMWc?skwBzpw;GB8xBF)%c=FfjZA3N^f7U???UV0e|lz+g3lfkC`r&aOZkpuXS$ zpAc7|0+Vy!%`Sd3J@*~Rz=H@Xz@vBMNCCrhU++~OAXQKjgnPb5^?zLm6yRy4l)f7mx|d; zx?*(k%?4)UEmyi0Ecrc2=k&YFn|8nX@qd4)(saLN%zo##oL4V9SpH%8W(I{5_Kby- zneS~VhopAyb6lBS&$U5E`gKppbdV7NQIC+SE zKe2ts8LoR*Hw$jqcIEDHSU_mi4;HoUDLTgOJMIHx zO|`@|q9i4;B-JXpC>2OC7#SEE>l#?<8d`)H8e5qfSQ#5>8yHy`7). +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +//############################################################################ + +openerp.auth_from_http_basic_logout = function(openerp) +{ + openerp.web.Session.include({ + session_logout: function() + { + var deferred = this._super(this, arguments); + deferred.fail(function(error, ev) + { + ev.preventDefault(); + openerp.web.blockUI(); + jQuery('.openerp_webclient_container').remove(); + jQuery('.oe_blockui_spin_container') + .empty() + .html( + _.string.sprintf( + openerp.web._t( + '

You have been logged out successfully. Click here to log in again.

') + )) + .click(function() + { + window.location.reload(); + }); + }); + return deferred; + } + }); +}