Skip to content

Commit

Permalink
Fix for nextcloud#3278
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Wessalowski <sebastian@wessalowski.org>
  • Loading branch information
whitekiba committed Mar 3, 2017
1 parent 8e27b81 commit cc19778
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions core/Controller/LoginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,9 @@ public function showLoginForm($user, $redirect_url, $remember_login) {
}

$parameters['canResetPassword'] = true;

$parameters['email_allowed'] = $this->config->getAppValue('user_ldap', 'ldap_loginfilter_email', true);

$parameters['resetPasswordLink'] = $this->config->getSystemValue('lost_password_link', '');
if (!$parameters['resetPasswordLink']) {
if (!is_null($user) && $user !== '') {
Expand Down
2 changes: 1 addition & 1 deletion core/templates/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</div>
<p class="grouptop<?php if (!empty($_['invalidpassword'])) { ?> shake<?php } ?>">
<input type="text" name="user" id="user"
placeholder="<?php p($l->t('Username or email')); ?>"
placeholder="<?php p($_['email_allowed'] ? $l->t('Username or email') : $l->t('Username')); ?>"
value="<?php p($_['loginName']); ?>"
<?php p($_['user_autofocus'] ? 'autofocus' : ''); ?>
autocomplete="on" autocapitalize="off" autocorrect="off" required>
Expand Down
3 changes: 3 additions & 0 deletions tests/Core/Controller/LoginControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public function testShowLoginFormWithErrorsInSession() {
'alt_login' => [],
'rememberLoginState' => 0,
'resetPasswordLink' => null,
'email_allowed' => null,
],
'guest'
);
Expand Down Expand Up @@ -239,6 +240,7 @@ public function testShowLoginFormWithPasswordResetOption($canChangePassword,
'alt_login' => [],
'rememberLoginState' => 0,
'resetPasswordLink' => false,
'email_allowed' => null,
],
'guest'
);
Expand Down Expand Up @@ -277,6 +279,7 @@ public function testShowLoginFormForUserNamedNull() {
'alt_login' => [],
'rememberLoginState' => 0,
'resetPasswordLink' => false,
'email_allowed' => null,
],
'guest'
);
Expand Down

0 comments on commit cc19778

Please sign in to comment.