diff --git a/admin-dev/themes/default/img/module-logout.png b/admin-dev/themes/default/img/module-logout.png new file mode 100755 index 000000000..7a9647dce Binary files /dev/null and b/admin-dev/themes/default/img/module-logout.png differ diff --git a/admin-dev/themes/default/img/module-profile.png b/admin-dev/themes/default/img/module-profile.png new file mode 100755 index 000000000..b15ad4b91 Binary files /dev/null and b/admin-dev/themes/default/img/module-profile.png differ diff --git a/admin-dev/themes/default/template/controllers/modules/filters.tpl b/admin-dev/themes/default/template/controllers/modules/filters.tpl index b1e907624..00ec77567 100644 --- a/admin-dev/themes/default/template/controllers/modules/filters.tpl +++ b/admin-dev/themes/default/template/controllers/modules/filters.tpl @@ -25,7 +25,23 @@ *} - {if !isset($logged_on_addons)} + {if isset($logged_on_addons)} + + +
+ +

{l s='You are logged on PrestaShop Addons'}

+ +
+ + + +
+ +
+ + + {else} {if $check_url_fopen eq 'ko' OR $check_openssl eq 'ko'} @@ -45,7 +61,7 @@ - +
diff --git a/admin-dev/themes/default/template/controllers/modules/js.tpl b/admin-dev/themes/default/template/controllers/modules/js.tpl index b85d37424..953b80176 100644 --- a/admin-dev/themes/default/template/controllers/modules/js.tpl +++ b/admin-dev/themes/default/template/controllers/modules/js.tpl @@ -35,7 +35,7 @@ var dirNameCurrentIndex = '{$dirNameCurrentIndex}'; var ajaxCurrentIndex = '{$ajaxCurrentIndex}'; var by = '{l s='by'}'; - var errorLogin = '{l s='Could not login to Addons'}'; + var errorLogin = '{l s='Could not login to Addons, please check your credentials and your internet connection.'}'; var confirmPreferencesSaved = '{l s='Preferences saved'}'; {if isset($smarty.get.anchor)}var anchor = '{$smarty.get.anchor|htmlentities|replace:'(':''|replace:')':''|replace:'{':''|replace:'}':''|replace:'\'':''|replace:'/':''}';{else}var anchor = '';{/if} @@ -233,6 +233,47 @@ }); + // Method to log out PrestaShop Addons WebServices + $('#addons_logout_button').click(function() + { + try + { + resAjax = $.ajax({ + type:"POST", + url : ajaxCurrentIndex, + async: true, + data : { + ajax : "1", + token : token, + controller : "AdminModules", + action : "logOutAddonsWebservices" + }, + beforeSend: function(xhr) + { + $('#addons_loading').html(''); + }, + success : function(data) + { + // res.status = cache or refresh + if (data == 'OK') + { + $('#addons_loading').html(''); + $('#addons_login_div').fadeOut(); + window.location.href = window.location.href; + } + else + $('#addons_loading').html(errorLogin); + }, + error: function(res,textStatus,jqXHR) + { + //jAlert("TECHNICAL ERROR"+res); + } + }); + } + catch(e){} + return false; + }); + // Method to set filter on modules function setFilter() diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 99b64a176..f8d5b14d4 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -289,6 +289,13 @@ class AdminModulesControllerCore extends AdminController die($result); } + public function ajaxProcessLogOutAddonsWebservices() + { + $this->context->cookie->username_addons = ''; + $this->context->cookie->password_addons = ''; + die('OK'); + } + public function ajaxProcessReloadModulesList() { if (Tools::getValue('filterCategory')) @@ -1084,7 +1091,10 @@ class AdminModulesControllerCore extends AdminController $tpl_vars['check_openssl'] = (extension_loaded('openssl') ? 'ok' : 'ko'); if ($this->logged_on_addons) + { $tpl_vars['logged_on_addons'] = 1; + $tpl_vars['username_addons'] = $this->context->cookie->username_addons; + } $smarty->assign($tpl_vars); }