@@ -20,9 +20,9 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | namespace OCA\Security\Tests\Controller; |
| 22 | 22 | |
| 23 | -use OCA\Security\Controller\SettingsController; |
|
| 24 | -use OCA\Security\SecurityConfig; |
|
| 25 | -use OCP\IRequest; |
|
| 23 | +use OCA\Security\Controller\SettingsController; |
|
| 24 | +use OCA\Security\SecurityConfig; |
|
| 25 | +use OCP\IRequest; |
|
| 26 | 26 | use Test\TestCase; |
| 27 | 27 | |
| 28 | 28 | class SettingsControllerTest extends TestCase {
|
@@ -22,9 +22,9 @@ |
||
| 22 | 22 | |
| 23 | 23 | namespace OCA\Security\Tests\Db; |
| 24 | 24 | |
| 25 | -use OCA\Security\Db\DbService; |
|
| 26 | -use OC\AppFramework\Utility\TimeFactory; |
|
| 27 | -use OCP\IDBConnection; |
|
| 25 | +use OCA\Security\Db\DbService; |
|
| 26 | +use OC\AppFramework\Utility\TimeFactory; |
|
| 27 | +use OCP\IDBConnection; |
|
| 28 | 28 | use Test\TestCase; |
| 29 | 29 | |
| 30 | 30 | /** |
@@ -19,10 +19,10 @@ |
||
| 19 | 19 | * |
| 20 | 20 | */ |
| 21 | 21 | namespace OCA\Password_Policy\Tests; |
| 22 | -use OC\HintException; |
|
| 23 | -use OCA\Security\SecurityConfig; |
|
| 24 | -use OCA\Security\PasswordValidator; |
|
| 25 | -use OCP\IL10N; |
|
| 22 | +use OC\HintException; |
|
| 23 | +use OCA\Security\SecurityConfig; |
|
| 24 | +use OCA\Security\PasswordValidator; |
|
| 25 | +use OCP\IL10N; |
|
| 26 | 26 | use Test\TestCase; |
| 27 | 27 | class PasswordValidatorTest extends TestCase {
|
| 28 | 28 | |
@@ -20,8 +20,8 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | namespace OCA\Security\Tests; |
| 22 | 22 | |
| 23 | -use OCA\Security\SecurityConfig; |
|
| 24 | -use OCP\IConfig; |
|
| 23 | +use OCA\Security\SecurityConfig; |
|
| 24 | +use OCP\IConfig; |
|
| 25 | 25 | use Test\TestCase; |
| 26 | 26 | class SecurityConfigTest extends TestCase {
|
| 27 | 27 | /** @var IConfig|\PHPUnit_Framework_MockObject_MockObject */ |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | <div id="brute-force-protection"> |
| 27 | 27 | <div> |
| 28 | 28 | <input type="checkbox" class="checkbox" id="security-brute-force-protection-enabled" |
| 29 | - <?php if ($_['isBruteForceProtectionEnabled']) p("checked");?> >
|
|
| 29 | + <?php if ($_['isBruteForceProtectionEnabled']) p("checked"); ?> >
|
|
| 30 | 30 | <label for="security-brute-force-protection-enabled"><?php p($l->t('Activate Brute Force Protection')) ?></label>
|
| 31 | 31 | </div> |
| 32 | 32 | </div> |
@@ -36,22 +36,22 @@ discard block |
||
| 36 | 36 | <div> |
| 37 | 37 | <label for="security-min-password-length"><?php p($l->t('Determine minimum password length')) ?></label>
|
| 38 | 38 | <input type="number" id="security-min-password-length" min="6" value="<?php p($_['minPasswordLength']) ?>"> |
| 39 | - <button id="save-pass-length" class="save"><?php p($l->t('Save Length'));?></button>
|
|
| 39 | + <button id="save-pass-length" class="save"><?php p($l->t('Save Length')); ?></button>
|
|
| 40 | 40 | <span id="security-min-password-length-message" class="msg"></span> |
| 41 | 41 | </div> |
| 42 | 42 | <div> |
| 43 | 43 | <input type="checkbox" class="checkbox" id="security-enforce-upper-lower-case" |
| 44 | - <?php if ($_['isUpperLowerCaseEnforced']) p("checked");?> >
|
|
| 44 | + <?php if ($_['isUpperLowerCaseEnforced']) p("checked"); ?> >
|
|
| 45 | 45 | <label for="security-enforce-upper-lower-case"><?php p($l->t('Enforce at least one upper and one lower case character on passwords')) ?></label>
|
| 46 | 46 | </div> |
| 47 | 47 | <div> |
| 48 | 48 | <input type="checkbox" class="checkbox" id="security-enforce-numerical-characters" |
| 49 | - <?php if ($_['isNumericalCharsEnforced']) p("checked");?> >
|
|
| 49 | + <?php if ($_['isNumericalCharsEnforced']) p("checked"); ?> >
|
|
| 50 | 50 | <label for="security-enforce-numerical-characters"><?php p($l->t('Enforce at least one numerical characters on passwords')) ?></label>
|
| 51 | 51 | </div> |
| 52 | 52 | <div> |
| 53 | 53 | <input type="checkbox" class="checkbox" id="security-enforce-special-characters" |
| 54 | - <?php if ($_['isSpecialCharsEnforced']) p("checked");?> >
|
|
| 54 | + <?php if ($_['isSpecialCharsEnforced']) p("checked"); ?> >
|
|
| 55 | 55 | <label for="security-enforce-special-characters"><?php p($l->t('Enforce at least one special characters on passwords')) ?></label>
|
| 56 | 56 | </div> |
| 57 | 57 | </div> |
| 58 | 58 | \ No newline at end of file |
@@ -25,15 +25,15 @@ |
||
| 25 | 25 | ?> |
| 26 | 26 | <div id="password-policies" class="hidden"> |
| 27 | 27 | <?php print_unescaped( |
| 28 | - "<p>". $l->t('Passwords must:'). "</p>");?>
|
|
| 28 | + "<p>".$l->t('Passwords must:')."</p>"); ?>
|
|
| 29 | 29 | <ul class="pass-info"> |
| 30 | 30 | <?php print_unescaped( |
| 31 | - "<li class='pass-info-element'>". $l->t('be at least 8 characters long ', $_['minPasswordLength']). "</li>");?>
|
|
| 31 | + "<li class='pass-info-element'>".$l->t('be at least 8 characters long ', $_['minPasswordLength'])."</li>"); ?>
|
|
| 32 | 32 | <?php if ($_['isUpperLowerCaseEnforced']) print_unescaped( |
| 33 | - "<li class='pass-info-element'>". $l->t('contain at least one uppercase letter and at least one lowercase letter '). "</li>");?>
|
|
| 33 | + "<li class='pass-info-element'>".$l->t('contain at least one uppercase letter and at least one lowercase letter ')."</li>"); ?>
|
|
| 34 | 34 | <?php if ($_['isNumericalCharsEnforced']) print_unescaped( |
| 35 | - "<li class='pass-info-element'>". $l->t('contain at least one numerical character'). "</li>");?>
|
|
| 35 | + "<li class='pass-info-element'>".$l->t('contain at least one numerical character')."</li>"); ?>
|
|
| 36 | 36 | <?php if ($_['isSpecialCharsEnforced']) print_unescaped( |
| 37 | - "<li class='pass-info-element'>". $l->t('contain at least one special character'). "</li>");?>
|
|
| 37 | + "<li class='pass-info-element'>".$l->t('contain at least one special character')."</li>"); ?>
|
|
| 38 | 38 | </ul> |
| 39 | 39 | </div> |
@@ -23,9 +23,9 @@ |
||
| 23 | 23 | } |
| 24 | 24 | require_once __DIR__.'/../../../lib/base.php'; |
| 25 | 25 | |
| 26 | -OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT . '/tests/lib', true);
|
|
| 26 | +OC::$composerAutoloader->addPsr4('Test\\', OC::$SERVERROOT.'/tests/lib', true);
|
|
| 27 | 27 | |
| 28 | -if(!class_exists('PHPUnit_Framework_TestCase')) {
|
|
| 28 | +if (!class_exists('PHPUnit_Framework_TestCase')) {
|
|
| 29 | 29 | require_once('PHPUnit/Autoload.php');
|
| 30 | 30 | } |
| 31 | 31 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | use OC\HintException; |
| 23 | 23 | use OCP\IL10N; |
| 24 | 24 | |
| 25 | -class PasswordValidator {
|
|
| 25 | +class PasswordValidator {
|
|
| 26 | 26 | |
| 27 | 27 | /** @var SecurityConfig */ |
| 28 | 28 | protected $config; |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | */ |
| 63 | 63 | public function checkPasswordLength($password) {
|
| 64 | 64 | $minPassLength = $this->config->getMinPasswordLength(); |
| 65 | - if(strlen($password) < $minPassLength) {
|
|
| 66 | - $message = 'Password needs to be at least ' . $minPassLength . ' characters long'; |
|
| 65 | + if (strlen($password) < $minPassLength) {
|
|
| 66 | + $message = 'Password needs to be at least '.$minPassLength.' characters long'; |
|
| 67 | 67 | $hint = $this->l->t( |
| 68 | 68 | 'Password needs to be at least %s characters long', [$minPassLength] |
| 69 | 69 | ); |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | * @throws HintException |
| 79 | 79 | */ |
| 80 | 80 | public function checkUpperLowerCase($password) {
|
| 81 | - $enforceUpperLowerCase= $this->config->getIsUpperLowerCaseEnforced(); |
|
| 82 | - if($enforceUpperLowerCase === true && $this->hasUpperAndLowerCase($password) === false) {
|
|
| 81 | + $enforceUpperLowerCase = $this->config->getIsUpperLowerCaseEnforced(); |
|
| 82 | + if ($enforceUpperLowerCase === true && $this->hasUpperAndLowerCase($password) === false) {
|
|
| 83 | 83 | $message = 'Password should contain at least one upper and one lower case character.'; |
| 84 | 84 | $hint = $this->l->t( |
| 85 | 85 | 'Password should contain at least one upper and one lower case character.' |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | */ |
| 97 | 97 | public function checkNumericCharacters($password) {
|
| 98 | 98 | $enforceNumericCharacters = $this->config->getIsNumericCharactersEnforced(); |
| 99 | - if($enforceNumericCharacters === true && $this->hasNumericalCharacters($password) === false) {
|
|
| 99 | + if ($enforceNumericCharacters === true && $this->hasNumericalCharacters($password) === false) {
|
|
| 100 | 100 | $message = 'Password should contain at least one numerical character.'; |
| 101 | 101 | $hint = $this->l->t( |
| 102 | 102 | 'Password should contain at least one numerical character.' |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function checkSpecialCharacters($password) {
|
| 115 | 115 | $enforceSpecialCharacters = $this->config->getIsSpecialCharactersEnforced(); |
| 116 | - if($enforceSpecialCharacters === true && $this->hasSpecialCharacter($password) === false) {
|
|
| 116 | + if ($enforceSpecialCharacters === true && $this->hasSpecialCharacter($password) === false) {
|
|
| 117 | 117 | $message = 'Password should contain at least one special character.'; |
| 118 | 118 | $hint = $this->l->t( |
| 119 | 119 | 'Password should contain at least one special character.' |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | |
| 32 | 32 | class Application extends App {
|
| 33 | 33 | |
| 34 | - public function __construct(array $urlParams=array()){
|
|
| 34 | + public function __construct(array $urlParams = array()) {
|
|
| 35 | 35 | parent::__construct('security', $urlParams);
|
| 36 | 36 | |
| 37 | 37 | $container = $this->getContainer(); |