diff options
author | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-07 15:37:26 +0100 |
---|---|---|
committer | Joas Schilling <nickvergessen@owncloud.com> | 2015-12-17 16:35:46 +0100 |
commit | 04c2247b0d96df632e7660a5143777e0b1adbf08 (patch) | |
tree | e957a20763d09914dfdc998920d60bb538df940c | |
parent | 5fe8f5a2549c76a129a19e536bc5a7aa9c3554a7 (diff) | |
download | nextcloud-server-04c2247b0d96df632e7660a5143777e0b1adbf08.tar.gz nextcloud-server-04c2247b0d96df632e7660a5143777e0b1adbf08.zip |
Allow specifying a custom reset-password-url
Conflicts:
core/js/config.php
-rw-r--r-- | config/config.sample.php | 8 | ||||
-rw-r--r-- | core/js/config.php | 1 | ||||
-rw-r--r-- | core/js/lostpassword.js | 12 | ||||
-rw-r--r-- | lib/private/util.php | 8 |
4 files changed, 22 insertions, 7 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 02e5aba3e94..cd551cc6ce0 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -215,6 +215,14 @@ $CONFIG = array( /** + * If your user backend does not allow to reset the password (e.g. when it's a + * read-only user backend like LDAP), you can specify a custom link, where the + * user is redirected to, when clicking the "reset password" link after a failed + * login-attempt. + */ +'lost_password_link' => 'https://example.org/link/to/password/reset', + +/** * Mail Parameters * * These configure the email settings for ownCloud notifications and password diff --git a/core/js/config.php b/core/js/config.php index e2d7ae3784c..7fa181c7020 100644 --- a/core/js/config.php +++ b/core/js/config.php @@ -141,6 +141,7 @@ $array = array( 'version' => implode('.', OC_Util::getVersion()), 'versionstring' => OC_Util::getVersionString(), 'enable_avatars' => \OC::$server->getConfig()->getSystemValue('enable_avatars', true), + 'lost_password_link'=> \OC::$server->getConfig()->getSystemValue('lost_password_link', null), ) ), "oc_appconfig" => json_encode( diff --git a/core/js/lostpassword.js b/core/js/lostpassword.js index 294a9d8c1cf..df28c2308cb 100644 --- a/core/js/lostpassword.js +++ b/core/js/lostpassword.js @@ -13,22 +13,26 @@ OC.Lostpassword = { resetErrorMsg : t('core', 'Password can not be changed. Please contact your administrator.'), init : function() { - $('#lost-password').click(OC.Lostpassword.sendLink); + $('#lost-password').click(OC.Lostpassword.resetLink); $('#reset-password #submit').click(OC.Lostpassword.resetPassword); }, - sendLink : function(event){ + resetLink : function(event){ event.preventDefault(); if (!$('#user').val().length){ $('#submit').trigger('click'); } else { - $.post( + if (OC.config['lost_password_link']) { + window.location = OC.config['lost_password_link']; + } else { + $.post( OC.generateUrl('/lostpassword/email'), { user : $('#user').val() }, OC.Lostpassword.sendLinkDone - ); + ); + } } }, diff --git a/lib/private/util.php b/lib/private/util.php index 087919d5b35..e06493b09be 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -948,9 +948,11 @@ class OC_Util { } $parameters['canResetPassword'] = true; - $user = \OC::$server->getUserManager()->get($_REQUEST['user']); - if ($user instanceof IUser) { - $parameters['canResetPassword'] = $user->canChangePassword(); + if (!\OC::$server->getSystemConfig()->getValue('lost_password_link')) { + $user = \OC::$server->getUserManager()->get($_REQUEST['user']); + if ($user instanceof IUser) { + $parameters['canResetPassword'] = $user->canChangePassword(); + } } $parameters['alt_login'] = OC_App::getAlternativeLogIns(); |