From 2edda96443e4cb163c164b1500bb942093df909a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szab=C3=B3=20Gyula?= Date: Wed, 15 Oct 2014 14:38:53 +0200 Subject: [PATCH 1/2] password reset for saml auth --- user_saml/ajax/regenerate_password.php | 22 ++++++++++++ user_saml/js/personalsettings.js | 17 +++++++++ user_saml/personalsettings.php | 46 ++++++++++++++++++++++++ user_saml/templates/personalsettings.php | 9 +++++ 4 files changed, 94 insertions(+) create mode 100644 user_saml/ajax/regenerate_password.php create mode 100644 user_saml/js/personalsettings.js create mode 100644 user_saml/personalsettings.php create mode 100644 user_saml/templates/personalsettings.php diff --git a/user_saml/ajax/regenerate_password.php b/user_saml/ajax/regenerate_password.php new file mode 100644 index 0000000000..f270df5687 --- /dev/null +++ b/user_saml/ajax/regenerate_password.php @@ -0,0 +1,22 @@ + $password)); +} else { + \OC_JSON::error(); +} + + diff --git a/user_saml/js/personalsettings.js b/user_saml/js/personalsettings.js new file mode 100644 index 0000000000..08afcecbab --- /dev/null +++ b/user_saml/js/personalsettings.js @@ -0,0 +1,17 @@ +$(document).ready(function() { + $('#regenerate_password_button').on( "click", function(){ + OC.dialogs.confirm( + t('user_saml', 'Are you sure to reset your desktop client password?'), + t('user_saml', 'Reset desktop client password?'), + function(reset) { + if(reset) { + $.post(OC.filePath('user_saml', 'ajax', 'regenerate_password.php'), "regenerate_password", function(data){ + $("#newpassword").text(data.data); + }); + } + }, + true + ); + + }); +}); diff --git a/user_saml/personalsettings.php b/user_saml/personalsettings.php new file mode 100644 index 0000000000..7d76b1cb03 --- /dev/null +++ b/user_saml/personalsettings.php @@ -0,0 +1,46 @@ + + * @copyright 2012 Yaco Sistemas // CONFIA + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE + * License as published by the Free Software Foundation; either + * version 3 of the License, or any later version. + * + * This library 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 library. If not, see . + * + */ + +OC_Util::checkLoggedIn(); + +$params = array('regenerate_password'); + +OCP\Util::addscript('user_saml', 'personalsettings'); + +if ($_POST) { + // CSRF check + OCP\JSON::callCheck(); + + foreach($params as $param) { + if (isset($_POST[$param])) { + var_dump($param); + } + } +} + +// fill template +$tmpl = new OCP\Template( 'user_saml', 'personalsettings'); + +// settings with default values + +return $tmpl->fetchPage(); diff --git a/user_saml/templates/personalsettings.php b/user_saml/templates/personalsettings.php new file mode 100644 index 0000000000..27101fef62 --- /dev/null +++ b/user_saml/templates/personalsettings.php @@ -0,0 +1,9 @@ + + +
+

t('Reset desktop client password'));?>

+ + +
And your new password is...
+
t("Be careful. We will show your new password only once. If you reset it you have to change all syncronizing devices' password."));?>
+
From 0b02a2a71543d5e0c6c0b9e204751c90f6f88bd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gyula=20Szab=C3=B3?= Date: Tue, 9 Dec 2014 09:02:28 +0100 Subject: [PATCH 2/2] Update personalsettings.php --- user_saml/personalsettings.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/user_saml/personalsettings.php b/user_saml/personalsettings.php index 7d76b1cb03..914d7a7dcf 100644 --- a/user_saml/personalsettings.php +++ b/user_saml/personalsettings.php @@ -3,8 +3,7 @@ /** * ownCloud - user_saml * - * @author Sixto Martin - * @copyright 2012 Yaco Sistemas // CONFIA + * @author Szabó Gyula * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE