summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2015-12-07 15:14:19 +0100
committerJoas Schilling <nickvergessen@owncloud.com>2015-12-07 15:14:19 +0100
commitf8f3c9ecf9da1f14722f6d3266a0e80ea157f98f (patch)
treed2851d889610a6acf06a270aeba705c18ced42ed
parente44b164f406b52530d81e755c9e1b959e0f1ef27 (diff)
downloadnextcloud-server-f8f3c9ecf9da1f14722f6d3266a0e80ea157f98f.tar.gz
nextcloud-server-f8f3c9ecf9da1f14722f6d3266a0e80ea157f98f.zip
Remove password reset when the user can not change the password
-rw-r--r--core/templates/login.php8
-rw-r--r--lib/private/util.php6
2 files changed, 12 insertions, 2 deletions
diff --git a/core/templates/login.php b/core/templates/login.php
index 03be6258fdf..7b09d4fac95 100644
--- a/core/templates/login.php
+++ b/core/templates/login.php
@@ -56,11 +56,15 @@ script('core', [
<input type="submit" id="submit" class="login primary icon-confirm svg" title="<?php p($l->t('Log in')); ?>" value="" disabled="disabled"/>
</p>
- <?php if (isset($_['invalidpassword']) && ($_['invalidpassword'])): ?>
+ <?php if (!empty($_['invalidpassword']) && !empty($_['canResetPassword'])) { ?>
<a id="lost-password" class="warning" href="">
<?php p($l->t('Wrong password. Reset it?')); ?>
</a>
- <?php endif; ?>
+ <?php } else if (!empty($_['invalidpassword'])) { ?>
+ <p class="warning">
+ <?php p($l->t('Wrong password.')); ?>
+ </p>
+ <?php } ?>
<?php if ($_['rememberLoginAllowed'] === true) : ?>
<div class="remember-login-container">
<input type="checkbox" name="remember_login" value="1" id="remember_login" class="checkbox checkbox--white">
diff --git a/lib/private/util.php b/lib/private/util.php
index 9929b7d5b1c..532730998c6 100644
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -947,6 +947,12 @@ class OC_Util {
$parameters['redirect_url'] = $_REQUEST['redirect_url'];
}
+ $parameters['canResetPassword'] = true;
+ $user = \OC::$server->getUserManager()->get($_REQUEST['user']);
+ if ($user instanceof IUser) {
+ $parameters['canResetPassword'] = $user->canChangePassword();
+ }
+
$parameters['alt_login'] = OC_App::getAlternativeLogIns();
$parameters['rememberLoginAllowed'] = self::rememberLoginAllowed();
\OC_Hook::emit('OC_Util', 'pre_displayLoginPage', array('parameters' => $parameters));