diff options
-rw-r--r-- | apps/theming/lib/ThemingDefaults.php | 10 | ||||
-rw-r--r-- | apps/theming/tests/ThemingDefaultsTest.php | 14 | ||||
-rw-r--r-- | core/shipped.json | 1 | ||||
-rw-r--r-- | core/templates/layout.guest.php | 3 | ||||
-rw-r--r-- | lib/private/Mail/EMailTemplate.php | 2 | ||||
-rw-r--r-- | lib/private/legacy/defaults.php | 17 | ||||
-rw-r--r-- | lib/public/Defaults.php | 5 | ||||
-rw-r--r-- | lib/public/Security/ISecureRandom.php | 7 | ||||
-rw-r--r-- | settings/BackgroundJobs/VerifyUserData.php | 15 | ||||
-rw-r--r-- | settings/Controller/AuthSettingsController.php | 8 | ||||
-rw-r--r-- | settings/css/settings.css | 2 | ||||
-rw-r--r-- | tests/Settings/Controller/AuthSettingsControllerTest.php | 6 | ||||
-rw-r--r-- | version.php | 4 |
13 files changed, 67 insertions, 27 deletions
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php index 9509fc11077..0824a36ccdc 100644 --- a/apps/theming/lib/ThemingDefaults.php +++ b/apps/theming/lib/ThemingDefaults.php @@ -129,9 +129,10 @@ class ThemingDefaults extends \OC_Defaults { /** * Themed logo url * + * @param bool $useSvg Whether to point to the SVG image or a fallback * @return string */ - public function getLogo() { + public function getLogo($useSvg = true) { $logo = $this->config->getAppValue('theming', 'logoMime', false); $logoExists = true; @@ -144,7 +145,12 @@ class ThemingDefaults extends \OC_Defaults { $cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0'); if(!$logo || !$logoExists) { - return $this->urlGenerator->imagePath('core','logo.svg') . '?v=' . $cacheBusterCounter; + if($useSvg) { + $logo = $this->urlGenerator->imagePath('core', 'logo.svg'); + } else { + $logo = $this->urlGenerator->imagePath('core', 'logo.png'); + } + return $logo . '?v=' . $cacheBusterCounter; } return $this->urlGenerator->linkToRoute('theming.Theming.getLogo') . '?v=' . $cacheBusterCounter; diff --git a/apps/theming/tests/ThemingDefaultsTest.php b/apps/theming/tests/ThemingDefaultsTest.php index e3acab78bb7..a7cb7790aa6 100644 --- a/apps/theming/tests/ThemingDefaultsTest.php +++ b/apps/theming/tests/ThemingDefaultsTest.php @@ -431,7 +431,7 @@ class ThemingDefaultsTest extends TestCase { $this->assertEquals('custom-background?v=0', $this->template->getBackground()); } - public function testGetLogoDefault() { + private function getLogoHelper($withName, $useSvg) { $this->appData->expects($this->once()) ->method('getFolder') ->willThrowException(new NotFoundException()); @@ -452,9 +452,17 @@ class ThemingDefaultsTest extends TestCase { ->willThrowException(new \Exception()); $this->urlGenerator->expects($this->once()) ->method('imagePath') - ->with('core', 'logo.svg') + ->with('core', $withName) ->willReturn('core-logo'); - $this->assertEquals('core-logo?v=0', $this->template->getLogo()); + $this->assertEquals('core-logo?v=0', $this->template->getLogo($useSvg)); + } + + public function testGetLogoDefaultWithSvg() { + $this->getLogoHelper('logo.svg', true); + } + + public function testGetLogoDefaultWithoutSvg() { + $this->getLogoHelper('logo.png', false); } public function testGetLogoCustom() { diff --git a/core/shipped.json b/core/shipped.json index e114ec769e7..d064cbb5c37 100644 --- a/core/shipped.json +++ b/core/shipped.json @@ -5,7 +5,6 @@ "comments", "dav", "encryption", - "external", "federatedfilesharing", "federation", "files", diff --git a/core/templates/layout.guest.php b/core/templates/layout.guest.php index 1f38aaef5f9..2c2373d53aa 100644 --- a/core/templates/layout.guest.php +++ b/core/templates/layout.guest.php @@ -40,7 +40,8 @@ <h1 class="hidden-visually"> <?php p($theme->getName()); ?> </h1> - <?php if(\OC::$server->getConfig()->getAppValue('theming', 'logoMime', false)): ?> + <?php if(\OC::$server->getConfig()->getSystemValue('installed', false) + && \OC::$server->getConfig()->getAppValue('theming', 'logoMime', false)): ?> <img src="<?php p($theme->getLogo()); ?>"/> <?php endif; ?> </div> diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index 3442e8e9430..0ae79345e4c 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -357,7 +357,7 @@ EOF; } $this->headerAdded = true; - $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo()); + $logoUrl = $this->urlGenerator->getAbsoluteURL($this->themingDefaults->getLogo(false)); $this->htmlBody .= vsprintf($this->header, [$this->themingDefaults->getColorPrimary(), $logoUrl, $this->themingDefaults->getName()]); } diff --git a/lib/private/legacy/defaults.php b/lib/private/legacy/defaults.php index cc4991efd3e..f6d72d9776d 100644 --- a/lib/private/legacy/defaults.php +++ b/lib/private/legacy/defaults.php @@ -47,9 +47,8 @@ class OC_Defaults { private $defaultSlogan; private $defaultLogoClaim; private $defaultColorPrimary; - private $defaultLogoUrl; - function __construct() { + public function __construct() { $this->l = \OC::$server->getL10N('lib'); $this->defaultEntity = 'Nextcloud'; /* e.g. company name, used for footers and copyright notices */ @@ -65,8 +64,6 @@ class OC_Defaults { $this->defaultSlogan = $this->l->t('a safe home for all your data'); $this->defaultLogoClaim = ''; $this->defaultColorPrimary = '#0082c9'; - $this->defaultLogoUrl = \OC::$server->getURLGenerator()->imagePath('core','logo.svg'); - $this->defaultLogoUrl .= '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion())); $themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php'; if (file_exists($themePath)) { @@ -307,13 +304,19 @@ class OC_Defaults { /** * Themed logo url * + * @param bool $useSvg Whether to point to the SVG image or a fallback * @return string */ - public function getLogo() { + public function getLogo($useSvg = true) { if ($this->themeExist('getLogo')) { - return $this->theme->getLogo(); + return $this->theme->getLogo($useSvg); } - return $this->defaultLogoUrl; + if($useSvg) { + $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo.svg'); + } else { + $logo = \OC::$server->getURLGenerator()->imagePath('core', 'logo.png'); + } + return $logo . '?v=' . hash('sha1', implode('.', \OCP\Util::getVersion())); } } diff --git a/lib/public/Defaults.php b/lib/public/Defaults.php index dbde78bce68..543657694c5 100644 --- a/lib/public/Defaults.php +++ b/lib/public/Defaults.php @@ -178,11 +178,12 @@ class Defaults { /** * Themed logo url * + * @param bool $useSvg Whether to point to the SVG image or a fallback * @return string * @since 12.0.0 */ - public function getLogo() { - return $this->defaults->getLogo(); + public function getLogo($useSvg = true) { + return $this->defaults->getLogo($useSvg); } /** diff --git a/lib/public/Security/ISecureRandom.php b/lib/public/Security/ISecureRandom.php index c60529ef803..14190639f44 100644 --- a/lib/public/Security/ISecureRandom.php +++ b/lib/public/Security/ISecureRandom.php @@ -45,6 +45,13 @@ interface ISecureRandom { const CHAR_SYMBOLS = '!\"#$%&\\\'()* +,-./:;<=>?@[\]^_`{|}~'; /** + * Characters that can be used for <code>generate($length, $characters)</code>, to + * generate human readable random strings. Lower- and upper-case characters and digits + * are included. Characters which are ambiguous are excluded, such as I, l, and 1 and so on. + */ + const CHAR_HUMAN_READABLE = "abcdefgijkmnopqrstwxyzABCDEFGHJKLMNPQRSTWXYZ23456789"; + + /** * Convenience method to get a low strength random number generator. * * Low Strength should be used anywhere that random strings are needed diff --git a/settings/BackgroundJobs/VerifyUserData.php b/settings/BackgroundJobs/VerifyUserData.php index 4a32398f6c4..8c02ae1727c 100644 --- a/settings/BackgroundJobs/VerifyUserData.php +++ b/settings/BackgroundJobs/VerifyUserData.php @@ -96,6 +96,8 @@ class VerifyUserData extends Job { $jobList->remove($this, $this->argument); if ($this->retainJob) { $this->reAddJob($jobList, $this->argument); + } else { + $this->resetVerificationState(); } } @@ -270,4 +272,17 @@ class VerifyUserData extends Job { return ((time() - $lastRun) > $this->interval); } + + /** + * reset verification state after max tries are reached + */ + protected function resetVerificationState() { + $user = $this->userManager->get($this->argument['uid']); + if ($user !== null) { + $accountData = $this->accountManager->getUser($user); + $accountData[$this->argument['type']]['verified'] = AccountManager::NOT_VERIFIED; + $this->accountManager->updateUser($user, $accountData); + } + } + } diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php index 57192e119a9..7bb8a6654e6 100644 --- a/settings/Controller/AuthSettingsController.php +++ b/settings/Controller/AuthSettingsController.php @@ -154,16 +154,16 @@ class AuthSettingsController extends Controller { } /** - * Return a 20 digit device password + * Return a 25 digit device password * - * Example: ABCDE-FGHIJ-KLMNO-PQRST + * Example: AbCdE-fGhIj-KlMnO-pQrSt-12345 * * @return string */ private function generateRandomDeviceToken() { $groups = []; - for ($i = 0; $i < 4; $i++) { - $groups[] = $this->random->generate(5, implode('', range('A', 'Z'))); + for ($i = 0; $i < 5; $i++) { + $groups[] = $this->random->generate(5, ISecureRandom::CHAR_HUMAN_READABLE); } return implode('-', $groups); } diff --git a/settings/css/settings.css b/settings/css/settings.css index 95649fc23eb..fb71e5ece23 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -392,7 +392,7 @@ table.nostyle td { #new-app-login-name, #new-app-password { - width: 186px; + width: 245px; font-family: monospace; background-color: lightyellow; } diff --git a/tests/Settings/Controller/AuthSettingsControllerTest.php b/tests/Settings/Controller/AuthSettingsControllerTest.php index 7f4277acd73..5c1280ff4b0 100644 --- a/tests/Settings/Controller/AuthSettingsControllerTest.php +++ b/tests/Settings/Controller/AuthSettingsControllerTest.php @@ -133,11 +133,11 @@ class AuthSettingsControllerTest extends TestCase { ->method('getLoginName') ->will($this->returnValue('User13')); - $this->secureRandom->expects($this->exactly(4)) + $this->secureRandom->expects($this->exactly(5)) ->method('generate') - ->with(5, implode('', range('A', 'Z'))) + ->with(5, ISecureRandom::CHAR_HUMAN_READABLE) ->will($this->returnValue('XXXXX')); - $newToken = 'XXXXX-XXXXX-XXXXX-XXXXX'; + $newToken = 'XXXXX-XXXXX-XXXXX-XXXXX-XXXXX'; $this->tokenProvider->expects($this->once()) ->method('generateToken') diff --git a/version.php b/version.php index c1b989c8790..4f428c128aa 100644 --- a/version.php +++ b/version.php @@ -26,10 +26,10 @@ // between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel // when updating major/minor version number. -$OC_Version = array(12, 0, 0, 17); +$OC_Version = array(12, 0, 0, 18); // The human readable string -$OC_VersionString = '12.0 beta 1'; +$OC_VersionString = '12.0 beta 2'; $OC_VersionCanBeUpgradedFrom = [ 'nextcloud' => [ |