diff options
-rw-r--r-- | core/Controller/LostController.php | 15 | ||||
-rw-r--r-- | core/css/apps.scss | 9 | ||||
-rw-r--r-- | core/css/header.scss | 10 | ||||
-rw-r--r-- | lib/private/Log/File.php | 13 | ||||
-rw-r--r-- | settings/js/authtoken_view.js | 4 | ||||
-rw-r--r-- | tests/Core/Controller/LostControllerTest.php | 29 |
6 files changed, 64 insertions, 16 deletions
diff --git a/core/Controller/LostController.php b/core/Controller/LostController.php index 59a4e0b2534..d23a6c2970d 100644 --- a/core/Controller/LostController.php +++ b/core/Controller/LostController.php @@ -167,7 +167,7 @@ class LostController extends Controller { */ protected function checkPasswordResetToken($token, $userId) { $user = $this->userManager->get($userId); - if($user === null) { + if($user === null || !$user->isEnabled()) { throw new \Exception($this->l10n->t('Couldn\'t reset password because the token is invalid')); } @@ -340,16 +340,25 @@ class LostController extends Controller { /** * @param string $input * @return IUser - * @throws \Exception + * @throws \InvalidArgumentException */ protected function findUserByIdOrMail($input) { $user = $this->userManager->get($input); if ($user instanceof IUser) { + if (!$user->isEnabled()) { + throw new \InvalidArgumentException($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.')); + } + return $user; } $users = $this->userManager->getByEmail($input); if (count($users) === 1) { - return $users[0]; + $user = $users[0]; + if (!$user->isEnabled()) { + throw new \InvalidArgumentException($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.')); + } + + return $user; } throw new \InvalidArgumentException($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.')); diff --git a/core/css/apps.scss b/core/css/apps.scss index fd26f46bcdb..bbf72f45c53 100644 --- a/core/css/apps.scss +++ b/core/css/apps.scss @@ -598,7 +598,7 @@ kbd { .popovermenu { position: absolute; background-color: $color-main-background; - color: nc-lighten($color-main-text, 20%); + color: $color-main-text; border-radius: 3px; z-index: 110; margin: 5px; @@ -693,9 +693,9 @@ kbd { } .menuitem { width: 100%; - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)'; - filter: alpha(opacity = 50); - opacity: .5; + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)'; + filter: alpha(opacity = 70); + opacity: .7; &:hover, &:focus, &.active { -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=100)'; filter: alpha(opacity = 100); @@ -710,7 +710,6 @@ kbd { min-width: 0; /* Overwrite icons*/ min-height: 0; background-position: 10px center; - opacity: 0.7; /* Default button icon override */ } } } diff --git a/core/css/header.scss b/core/css/header.scss index f62759a89d3..cf430914f87 100644 --- a/core/css/header.scss +++ b/core/css/header.scss @@ -277,8 +277,8 @@ nav { } svg, span { - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)'; - opacity: .5; + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)'; + opacity: .7; } svg { margin-bottom: 2px; @@ -427,10 +427,10 @@ nav { display: block; height: 40px; color: $color-main-text; - opacity: .5; padding: 10px 12px 0; - -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=50)'; box-sizing: border-box; + -ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=70)'; + opacity: .7; img { margin-bottom: -3px; margin-right: 6px; @@ -500,7 +500,7 @@ nav { border-top-left-radius: 0; border-top-right-radius: 0; margin-top: 0; - color: rgba(0, 0, 0, .6); + color: rgba(0, 0, 0, .7); width: auto; left: 50%; top: 45px; diff --git a/lib/private/Log/File.php b/lib/private/Log/File.php index 97ec5012b1f..c6677dd528d 100644 --- a/lib/private/Log/File.php +++ b/lib/private/Log/File.php @@ -117,7 +117,18 @@ class File { 'userAgent', 'version' ); - $entry = json_encode($entry); + // PHP's json_encode only accept proper UTF-8 strings, loop over all + // elements to ensure that they are properly UTF-8 compliant or convert + // them manually. + foreach($entry as $key => $value) { + if(is_string($value)) { + $testEncode = json_encode($value); + if($testEncode === false) { + $entry[$key] = utf8_encode($value); + } + } + } + $entry = json_encode($entry, JSON_PARTIAL_OUTPUT_ON_ERROR); $handle = @fopen(self::$logFile, 'a'); if ((fileperms(self::$logFile) & 0777) != 0640) { @chmod(self::$logFile, 0640); diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index a26981e632e..a20434be872 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -36,10 +36,10 @@ + '<div class="popovermenu bubble open menu configure">' + '{{#if canScope}}' + '<input class="filesystem checkbox" type="checkbox" id="{{id}}_filesystem" {{#if scope.filesystem}}checked{{/if}}/>' - + '<label for="{{id}}_filesystem">' + t('core', 'Allow filesystem access') + '</label><br/>' + + '<label for="{{id}}_filesystem">' + t('settings', 'Allow filesystem access') + '</label><br/>' + '{{/if}}' + '{{#if canDelete}}' - + '<a class="icon icon-delete has-tooltip" title="' + t('core', 'Disconnect') + '">' + t('core', 'Revoke') +'</a>' + + '<a class="icon icon-delete has-tooltip" title="' + t('settings', 'Disconnect') + '">' + t('settings', 'Revoke') +'</a>' + '{{/if}}' + '</div>' + '</td>' diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php index ef419e40b40..0bdc11f8a2f 100644 --- a/tests/Core/Controller/LostControllerTest.php +++ b/tests/Core/Controller/LostControllerTest.php @@ -84,6 +84,9 @@ class LostControllerTest extends \Test\TestCase { $this->existingUser->expects($this->any()) ->method('getUID') ->willReturn('ExistingUser'); + $this->existingUser->expects($this->any()) + ->method('isEnabled') + ->willReturn(true); $this->config = $this->createMock(IConfig::class); $this->config->expects($this->any()) @@ -684,8 +687,34 @@ class LostControllerTest extends \Test\TestCase { $this->assertSame($expectedResponse, $response); } + public function testSetPasswordForDisabledUser() { + $user = $this->createMock(IUser::class); + $user->expects($this->any()) + ->method('isEnabled') + ->willReturn(false); + $user->expects($this->never()) + ->method('setPassword'); + + $this->config->method('getUserValue') + ->with('ValidTokenUser', 'core', 'lostpassword', null) + ->willReturn('encryptedData'); + $this->userManager->method('get') + ->with('DisabledUser') + ->willReturn($this->existingUser); + + $response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'DisabledUser', 'NewPassword', true); + $expectedResponse = [ + 'status' => 'error', + 'msg' => 'Couldn\'t reset password because the token is invalid' + ]; + $this->assertSame($expectedResponse, $response); + } + public function testSendEmailNoEmail() { $user = $this->createMock(IUser::class); + $user->expects($this->any()) + ->method('isEnabled') + ->willReturn(true); $this->userManager->method('userExists') ->with('ExistingUser') ->willReturn(true); |