Skip to content

Commit

Permalink
Merge pull request #45 from ticgal/bugfix/sanitizedSecret
Browse files Browse the repository at this point in the history
Bugfix/sanitized secret
  • Loading branch information
FrancisTicgal authored Apr 9, 2024
2 parents ff2a1ac + 9a84076 commit 1844fde
Show file tree
Hide file tree
Showing 11 changed files with 615 additions and 419 deletions.
4 changes: 4 additions & 0 deletions css/link.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.action-PluginOnetimesecretLink_1, .action-PluginOnetimesecretLink_1:hover {
background-color: #DD4A22;
color: white;
}
64 changes: 33 additions & 31 deletions front/config.form.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?php

/*
-------------------------------------------------------------------------
OneTimeSecret plugin for GLPI
Copyright (C) 2021-2023 by the TICgal Team.
https://www.tic.gal
-------------------------------------------------------------------------
LICENSE
This file is part of the OneTimeSecret plugin.
OneTimeSecret plugin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
OneTimeSecret plugin 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with OneTimeSecret. If not, see
<http: //www.gnu.org/licenses />.
--------------------------------------------------------------------------
@package OneTimeSecret
@author the TICgal team
@copyright Copyright (c) 2021-2023 TICgal team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://www.tic.gal
@since 2021-2023
----------------------------------------------------------------------
*/
/**
* -------------------------------------------------------------------------
* OneTimeSecret plugin for GLPI
* Copyright (C) 2021-2024 by the TICgal Team.
* https://www.tic.gal
* -------------------------------------------------------------------------
* LICENSE
* This file is part of the OneTimeSecret plugin.
* OneTimeSecret plugin is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* OneTimeSecret plugin 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with OneTimeSecret. If not, see
* <http: //www.gnu.org/licenses />.
* -------------------------------------------------------------------------
* @package OneTimeSecret
* @author the TICgal team
* @copyright Copyright (c) 2021-2024 TICgal team
* @license AGPL License 3.0 or (at your option) any later version
* http://www.gnu.org/licenses/agpl-3.0-standalone.html
* @link https://www.tic.gal
* @since 2021
* -------------------------------------------------------------------------
*/

include('../../../inc/includes.php');

Expand All @@ -42,8 +42,10 @@
$config = new PluginOnetimesecretConfig();
if (isset($_POST["update"])) {
$config->check($_POST['id'], UPDATE);
$_POST["apikey"] = (new GLPIKey())->encrypt($_POST["apikey"]);
$config->update($_POST);
Html::back();
}
Html::redirect($CFG_GLPI["root_doc"] . "/front/config.form.php?forcetab=" . urlencode('PluginOnetimesecretConfig$1'));

$redirect = $CFG_GLPI["root_doc"] . "/front/config.form.php";
$redirect .= "?forcetab=" . urlencode('PluginOnetimesecretConfig$1');
Html::redirect($redirect);
58 changes: 29 additions & 29 deletions front/link.form.php
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
<?php

/*
-------------------------------------------------------------------------
OneTimeSecret plugin for GLPI
Copyright (C) 2021-2023 by the TICgal Team.
https://www.tic.gal
-------------------------------------------------------------------------
LICENSE
This file is part of the OneTimeSecret plugin.
OneTimeSecret plugin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
OneTimeSecret plugin 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with OneTimeSecret. If not, see
<http: //www.gnu.org/licenses />.
--------------------------------------------------------------------------
@package OneTimeSecret
@author the TICgal team
@copyright Copyright (c) 2021-2023 TICgal team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://www.tic.gal
@since 2021-2023
----------------------------------------------------------------------
*/
/**
* -------------------------------------------------------------------------
* OneTimeSecret plugin for GLPI
* Copyright (C) 2021-2024 by the TICgal Team.
* https://www.tic.gal
* -------------------------------------------------------------------------
* LICENSE
* This file is part of the OneTimeSecret plugin.
* OneTimeSecret plugin is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* OneTimeSecret plugin 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with OneTimeSecret. If not, see
* <http: //www.gnu.org/licenses />.
* -------------------------------------------------------------------------
* @package OneTimeSecret
* @author the TICgal team
* @copyright Copyright (c) 2021-2024 TICgal team
* @license AGPL License 3.0 or (at your option) any later version
* http://www.gnu.org/licenses/agpl-3.0-standalone.html
* @link https://www.tic.gal
* @since 2021
* -------------------------------------------------------------------------
*/

include('../../../inc/includes.php');

Expand Down
73 changes: 42 additions & 31 deletions hook.php
Original file line number Diff line number Diff line change
@@ -1,36 +1,41 @@
<?php

/*
-------------------------------------------------------------------------
OneTimeSecret plugin for GLPI
Copyright (C) 2021-2023 by the TICgal Team.
https://www.tic.gal
-------------------------------------------------------------------------
LICENSE
This file is part of the OneTimeSecret plugin.
OneTimeSecret plugin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
OneTimeSecret plugin 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with OneTimeSecret. If not, see
<http: //www.gnu.org/licenses />.
--------------------------------------------------------------------------
@package OneTimeSecret
@author the TICgal team
@copyright Copyright (c) 2021-2023 TICgal team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://www.tic.gal
@since 2021-2023
----------------------------------------------------------------------
*/
/**
* -------------------------------------------------------------------------
* OneTimeSecret plugin for GLPI
* Copyright (C) 2021-2024 by the TICgal Team.
* https://www.tic.gal
* -------------------------------------------------------------------------
* LICENSE
* This file is part of the OneTimeSecret plugin.
* OneTimeSecret plugin is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
* OneTimeSecret plugin 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 General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with OneTimeSecret. If not, see
* <http: //www.gnu.org/licenses />.
* -------------------------------------------------------------------------
* @package OneTimeSecret
* @author the TICgal team
* @copyright Copyright (c) 2021-2024 TICgal team
* @license AGPL License 3.0 or (at your option) any later version
* http://www.gnu.org/licenses/agpl-3.0-standalone.html
* @link https://www.tic.gal
* @since 2021
* -------------------------------------------------------------------------
*/

function plugin_onetimesecret_install()
/**
* plugin_onetimesecret_install
*
* @return bool
*/
function plugin_onetimesecret_install(): bool
{
$migration = new Migration(PLUGIN_ONETIMESECRET_VERSION);

Expand All @@ -46,6 +51,7 @@ function plugin_onetimesecret_install()
}
}
}

$conf = Config::getConfigurationValues('core', ['notifications_push']);
if (!isset($conf['notifications_push'])) {
Config::setConfigurationValues('core', ['notifications_push' => 0]);
Expand All @@ -54,7 +60,12 @@ function plugin_onetimesecret_install()
return true;
}

function plugin_onetimesecret_uninstall()
/**
* plugin_onetimesecret_uninstall
*
* @return bool
*/
function plugin_onetimesecret_uninstall(): bool
{
$migration = new Migration(PLUGIN_ONETIMESECRET_VERSION);

Expand Down
Loading

0 comments on commit 1844fde

Please sign in to comment.