]> source.dussan.org Git - nextcloud-server.git/commitdiff
Remove password reset when the user can not change the password
authorJoas Schilling <nickvergessen@owncloud.com>
Mon, 7 Dec 2015 14:14:19 +0000 (15:14 +0100)
committerJoas Schilling <nickvergessen@owncloud.com>
Mon, 7 Dec 2015 14:14:19 +0000 (15:14 +0100)
core/templates/login.php
lib/private/util.php

index 03be6258fdf0a1fd4a33b230e840cb0d36184c9d..7b09d4fac95610c3e384c16b201d8af99c212b8a 100644 (file)
@@ -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">
index 9929b7d5b1cecd15d282afb2692fb0a6f8383baa..532730998c6528dc3b52b4cecd97aa396d30aa42 100644 (file)
@@ -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));