diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml
index f5bb4cb81b..99c84b794c 100644
--- a/config/configuration.sample.yml
+++ b/config/configuration.sample.yml
@@ -80,11 +80,10 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video]
authentication:
auto-create:
- enabled: false
templates: { }
captcha:
enabled: true
- trials-before-failure: 9
+ trials-before-display: 9
providers:
facebook:
enabled: false
diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php
index a78efc0a4c..bcb15e5d47 100644
--- a/lib/Alchemy/Phrasea/Command/Setup/Install.php
+++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php
@@ -37,7 +37,7 @@ class Install extends Command
->addOption('db-port', null, InputOption::VALUE_OPTIONAL, 'MySQL server port', 3306)
->addOption('db-user', null, InputOption::VALUE_OPTIONAL, 'MySQL server user', 'phrasea')
->addOption('db-password', null, InputOption::VALUE_OPTIONAL, 'MySQL server password', null)
- ->addOption('db-template', null, InputOption::VALUE_OPTIONAL, 'Metadata structure language template', null)
+ ->addOption('db-template', null, InputOption::VALUE_OPTIONAL, 'Metadata structure language template (available are fr (french) and en (english))', null)
->addOption('databox', null, InputOption::VALUE_OPTIONAL, 'Database name for the DataBox', null)
->addOption('appbox', null, InputOption::VALUE_OPTIONAL, 'Database name for the ApplicationBox', null)
->addOption('indexer', null, InputOption::VALUE_OPTIONAL, 'Path to Phraseanet Indexer', 'auto')
@@ -126,7 +126,7 @@ class Install extends Command
$hostname = $dialog->ask($output, "DB hostname (localhost) : ", 'localhost');
$port = $dialog->ask($output, "DB port (3306) : ", 3306);
$dbUser = $dialog->ask($output, "DB user : ");
- $dbPassword = $dialog->ask($output, "DB password : ");
+ $dbPassword = $dialog->askHiddenResponse($output, "DB password (hidden) : ");
$abName = $dialog->ask($output, "DB name (phraseanet) : ", 'phraseanet');
try {
@@ -148,7 +148,7 @@ class Install extends Command
{
$credentials = $abConn->get_credentials();
- $dbConn = null;
+ $dbConn = $template = null;
if (!$input->getOption('databox')) {
do {
$retry = false;
@@ -160,7 +160,7 @@ class Install extends Command
$output->writeln("\n\tData-Box : Connection successful !\n");
do {
- $template = $dialog->ask($output, 'Choose a language template for metadata structure (en) : ', 'en');
+ $template = $dialog->ask($output, 'Choose a language template for metadata structure, available are fr (french) and en (english) (en) : ', 'en');
} while (!in_array($template, array('en', 'fr')));
$output->writeln("\n\tLanguage selected is '$template'\n");
@@ -192,7 +192,7 @@ class Install extends Command
} while (!\Swift_Validate::email($email));
do {
- $password = $dialog->ask($output, 'Please provide a password (6 character min) : ');
+ $password = $dialog->askHiddenResponse($output, 'Please provide a password (hidden, 6 character min) : ');
} while (strlen($password) < 6);
$output->writeln("\n\tEmail / Password successfully set\n");
diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php
index ab345baa0c..fb02a9dac9 100644
--- a/lib/Alchemy/Phrasea/Controller/Admin/Databox.php
+++ b/lib/Alchemy/Phrasea/Controller/Admin/Databox.php
@@ -854,9 +854,7 @@ class Databox implements ControllerProviderInterface
));
}
- return $app->redirectPath('admin_database', array(
- 'databox_id' => $databox_id,
- 'error' => 'file-too-big',
+ return $app->redirectPath('admin_databases', array(
'reload-tree' => 1,
));
}
diff --git a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php
index 8fef608c36..3b1f93a861 100644
--- a/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php
+++ b/lib/Alchemy/Phrasea/Controller/Admin/Databoxes.php
@@ -186,6 +186,7 @@ class Databoxes implements ControllerProviderInterface
'error_msg' => $errorMsg,
'recommendations' => $upgrader->getRecommendations(),
'advices' => $request->query->get('advices', array()),
+ 'reloadTree' => (Boolean) $request->query->get('reload-tree'),
));
}
diff --git a/lib/Alchemy/Phrasea/Controller/Root/Login.php b/lib/Alchemy/Phrasea/Controller/Root/Login.php
index b4123ac171..d235893e46 100644
--- a/lib/Alchemy/Phrasea/Controller/Root/Login.php
+++ b/lib/Alchemy/Phrasea/Controller/Root/Login.php
@@ -603,6 +603,7 @@ class Login implements ControllerProviderInterface
$url = $app->url('login_renew_password', array('token' => $token), true);
$mail = MailRequestPasswordUpdate::create($app, $receiver);
+ $mail->setLogin($user->get_login());
$mail->setButtonUrl($url);
$app['notification.deliverer']->deliver($mail);
diff --git a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php
index 51174ba1c8..9648ec7304 100644
--- a/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php
+++ b/lib/Alchemy/Phrasea/Core/Provider/AuthenticationManagerServiceProvider.php
@@ -67,8 +67,10 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
}
}, $authConf['auto-create']['templates']));
+
+ $enabled = $app['phraseanet.registry']->get('GV_autoregister') && $app['registration.enabled'];
- return new AccountCreator($app['tokens'], $app['phraseanet.appbox'], $authConf['auto-create']['enabled'], $templates);
+ return new AccountCreator($app['tokens'], $app['phraseanet.appbox'], $enabled, $templates);
});
$app['authentication.providers'] = $app->share(function (Application $app) {
@@ -101,7 +103,7 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
$app['auth.native.failure-manager'] = $app->share(function (Application $app) {
$authConf = $app['phraseanet.configuration']['authentication']['captcha'];
- return new FailureManager($app['EM'], $app['recaptcha'], isset($authConf['trials-before-failure']) ? $authConf['trials-before-failure'] : 9);
+ return new FailureManager($app['EM'], $app['recaptcha'], isset($authConf['trials-before-display']) ? $authConf['trials-before-display'] : 9);
});
$app['auth.password-checker'] = $app->share(function (Application $app) {
diff --git a/lib/Alchemy/Phrasea/Core/Version.php b/lib/Alchemy/Phrasea/Core/Version.php
index 5a26a347e8..3c0893c844 100644
--- a/lib/Alchemy/Phrasea/Core/Version.php
+++ b/lib/Alchemy/Phrasea/Core/Version.php
@@ -18,7 +18,7 @@ namespace Alchemy\Phrasea\Core;
*/
class Version
{
- protected static $number = '3.8.0.a16';
+ protected static $number = '3.8.0.a17';
protected static $name = 'Carnosaurus';
public static function getNumber()
diff --git a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php
index f3c0760aae..38507ff139 100644
--- a/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php
+++ b/lib/Alchemy/Phrasea/Notification/Mail/MailRequestPasswordUpdate.php
@@ -11,8 +11,23 @@
namespace Alchemy\Phrasea\Notification\Mail;
+use Alchemy\Phrasea\Exception\LogicException;
+
class MailRequestPasswordUpdate extends AbstractMailWithLink
{
+ /** @var string */
+ private $login;
+
+ /**
+ * Sets the login related to the password renewal
+ *
+ * @param string $login
+ */
+ public function setLogin($login)
+ {
+ $this->login = $login;
+ }
+
/**
* {@inheritdoc}
*/
@@ -26,7 +41,11 @@ class MailRequestPasswordUpdate extends AbstractMailWithLink
*/
public function getMessage()
{
- return _('login:: Quelqu\'un a demande a reinitialiser le mode passe correspondant au login suivant : ')
+ if (!$this->login) {
+ throw new LogicException('You must set a login before calling getMessage');
+ }
+
+ return sprintf(_('Password renewal for login "%s" has been requested'), $this->login)
. "\n"
. _('login:: Visitez le lien suivant et suivez les instructions pour continuer, sinon ignorez cet email et il ne se passera rien');
}
diff --git a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
index 6b808b9a0f..c65d891bbf 100644
--- a/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
+++ b/lib/Alchemy/Phrasea/SearchEngine/Phrasea/PhraseaEngine.php
@@ -61,6 +61,7 @@ class PhraseaEngine implements SearchEngineInterface
public function getAvailableDateFields()
{
if (!$this->dateFields) {
+ $this->dateFields = array();
foreach ($this->app['phraseanet.appbox']->get_databoxes() as $databox) {
foreach ($databox->get_meta_structure() as $databox_field) {
if ($databox_field->get_type() != \databox_field::TYPE_DATE) {
diff --git a/lib/classes/module/console/systemBackupDB.php b/lib/classes/module/console/systemBackupDB.php
index 71939f6584..ee6db8de4d 100644
--- a/lib/classes/module/console/systemBackupDB.php
+++ b/lib/classes/module/console/systemBackupDB.php
@@ -35,6 +35,7 @@ class module_console_systemBackupDB extends Command
$this
->setDescription('Backup Phraseanet Databases')
->addArgument('directory', null, 'The directory where to backup', $dir)
+ ->addOption('timeout', 't', null, 'The timeout for this command (default is 3600s / 1h). Set 0 to disable timeout.', 3600)
->addOption('gzip', 'g', null, 'Gzip the output (requires gzip utility)')
->addOption('bzip', 'b', null, 'Bzip the output (requires bzip2 utility)');
@@ -89,6 +90,7 @@ class module_console_systemBackupDB extends Command
$command .= ' > ' . escapeshellarg($filename);
$process = new Process($command);
+ $process->setTimeout((int) $input->getOption('timeout'));
$process->run();
if (!$process->isSuccessful()) {
diff --git a/lib/classes/patch/3817.php b/lib/classes/patch/3817.php
new file mode 100644
index 0000000000..5a9ea516b9
--- /dev/null
+++ b/lib/classes/patch/3817.php
@@ -0,0 +1,66 @@
+release;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function require_all_upgrades()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function concern()
+ {
+ return $this->concern;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function apply(base $appbox, Application $app)
+ {
+ $auth = $app['phraseanet.configuration']['authentication'];
+
+ if (isset($auth['captcha']) && isset($auth['captcha']['trials-before-failure'])) {
+ $auth['captcha']['trials-before-display'] = $auth['captcha']['trials-before-failure'];
+ unset($auth['captcha']['trials-before-failure']);
+ }
+
+ if (isset($auth['auto-create']) && isset($auth['auto-create']['enabled'])) {
+ unset($auth['auto-create']['enabled']);
+ }
+
+ $app['phraseanet.configuration']['authentication'] = $auth;
+
+ return true;
+ }
+}
diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml
index 4b348d348f..f492de6951 100644
--- a/lib/conf.d/configuration.yml
+++ b/lib/conf.d/configuration.yml
@@ -83,11 +83,10 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video]
authentication:
auto-create:
- enabled: false
templates: { }
captcha:
enabled: true
- trials-before-failure: 9
+ trials-before-display: 9
providers:
facebook:
enabled: false
diff --git a/templates/web/admin/databases.html.twig b/templates/web/admin/databases.html.twig
index a00dbde5b6..b6b5fe1945 100644
--- a/templates/web/admin/databases.html.twig
+++ b/templates/web/admin/databases.html.twig
@@ -1,3 +1,9 @@
+{% if reloadTree %}
+
+{% endif %}
+
{% if app['request'].query.get('success') == '1' %}
×
diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml
index 55b4553acd..58c79f2194 100644
--- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml
+++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml
@@ -68,11 +68,10 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video]
authentication:
auto-create:
- enabled: false
templates: { }
captcha:
enabled: true
- trials-before-failure: 9
+ trials-before-display: 9
providers:
facebook:
enabled: false
@@ -116,8 +115,6 @@ registration-fields:
required: true
xsendfile:
enabled: false
- type: ''
- mapping:
- -
- directory: ''
- mount-point: ''
+ type: nginx
+ mapping: []
+plugins: []
diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml
index 55b4553acd..58c79f2194 100644
--- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml
+++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml
@@ -68,11 +68,10 @@ border-manager:
mediatypes: [Audio, Document, Flash, Image, Video]
authentication:
auto-create:
- enabled: false
templates: { }
captcha:
enabled: true
- trials-before-failure: 9
+ trials-before-display: 9
providers:
facebook:
enabled: false
@@ -116,8 +115,6 @@ registration-fields:
required: true
xsendfile:
enabled: false
- type: ''
- mapping:
- -
- directory: ''
- mount-point: ''
+ type: nginx
+ mapping: []
+plugins: []
diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml
index 85d4fe3e4a..cc2a01a159 100644
--- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml
+++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-debugger.yml
@@ -93,11 +93,10 @@ border-manager:
- Video
authentication:
auto-create:
- enabled: false
templates: { }
captcha:
enabled: true
- trials-before-failure: 9
+ trials-before-display: 9
providers:
facebook:
enabled: false
diff --git a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml
index 42f4b2f2ba..777037aa2b 100644
--- a/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml
+++ b/tests/Alchemy/Tests/Phrasea/Core/Event/Subscriber/Fixtures/configuration-maintenance.yml
@@ -93,11 +93,10 @@ border-manager:
- Video
authentication:
auto-create:
- enabled: false
templates: { }
captcha:
enabled: true
- trials-before-failure: 9
+ trials-before-display: 9
providers:
facebook:
enabled: false
diff --git a/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php b/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php
index fad55d5360..af9dd08ef3 100644
--- a/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Core/Provider/AuthenticationManagerServiceProviderTest.php
@@ -88,7 +88,7 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$app->register(new ConfigurationServiceProvider());
$app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig();
- $conf['authentication']['captcha']['trials-before-failure'] = 42;
+ $conf['authentication']['captcha']['trials-before-display'] = 42;
$app['phraseanet.configuration'] = $conf;
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
@@ -107,12 +107,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$app = new PhraseaApplication();
$app->register(new ConfigurationServiceProvider());
- $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig();
+ $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['auto-create'] = array(
- 'enabled' => true,
'templates' => array(),
);
- $app['phraseanet.configuration'] = $conf;
+ $app['phraseanet.configuration']->setConfig($conf);
$app['authentication.providers.account-creator'];
}
@@ -139,11 +138,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
}));
$app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox'];
- $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig();
+ $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['captcha'] = array(
'enabled' => true,
);
- $app['phraseanet.configuration'] = $conf;
+ $app['phraseanet.configuration']->setConfig($conf);
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor()
@@ -177,11 +176,11 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
}));
$app['phraseanet.appbox'] = self::$DI['app']['phraseanet.appbox'];
- $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig();
+ $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['captcha'] = array(
'enabled' => false,
);
- $app['phraseanet.configuration'] = $conf;
+ $app['phraseanet.configuration']->setConfig($conf);
$app['EM'] = $this->getMockBuilder('Doctrine\Orm\EntityManager')
->disableOriginalConstructor()
@@ -203,15 +202,14 @@ class AuthenticationManagerServiceProvidertest extends ServiceProviderTestCase
$template2 = \User_Adapter::create(self::$DI['app'], 'template' . $random->generatePassword(), $random->generatePassword(), null, false);
$template2->set_template(self::$DI['user']);
- $app['phraseanet.configuration'] = $conf = $app['phraseanet.configuration']->getConfig();
+ $conf = $app['phraseanet.configuration']->getConfig();
$conf['authentication']['auto-create'] = array(
- 'enabled' => true,
'templates' => array(
$template1->get_id(),
$template2->get_login()
)
);
- $app['phraseanet.configuration'] = $conf;
+ $app['phraseanet.configuration']->setConfig($conf);
$this->assertEquals(array($template1, $template2), $app['authentication.providers.account-creator']->getTemplates());
diff --git a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php
index a4be2fe1ac..cfcd519715 100644
--- a/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php
+++ b/tests/Alchemy/Tests/Phrasea/Notification/Mail/MailRequestPasswordUpdateTest.php
@@ -3,15 +3,22 @@
namespace Alchemy\Tests\Phrasea\Notification\Mail;
use Alchemy\Phrasea\Notification\Mail\MailRequestPasswordUpdate;
+use Alchemy\Phrasea\Exception\LogicException;
/**
* @covers Alchemy\Phrasea\Notification\Mail\MailRequestPasswordUpdate
*/
class MailRequestPasswordUpdateTest extends MailWithLinkTestCase
{
+ public function testSetLogin()
+ {
+ $mail = $this->getMail();
+ $this->assertTrue(false !== strpos($mail->getMessage(), 'RomainNeutron'));
+ }
+
public function getMail()
{
- return MailRequestPasswordUpdate::create(
+ $mail = MailRequestPasswordUpdate::create(
$this->getApp(),
$this->getReceiverMock(),
$this->getEmitterMock(),
@@ -19,5 +26,28 @@ class MailRequestPasswordUpdateTest extends MailWithLinkTestCase
$this->getUrl(),
$this->getExpiration()
);
+
+ $mail->setLogin('RomainNeutron');
+
+ return $mail;
+ }
+
+ public function testThatALogicExceptionIsThrownIfNoLoginProvided()
+ {
+ $mail = MailRequestPasswordUpdate::create(
+ $this->getApp(),
+ $this->getReceiverMock(),
+ $this->getEmitterMock(),
+ $this->getMessage(),
+ $this->getUrl(),
+ $this->getExpiration()
+ );
+
+ try {
+ $mail->getMessage();
+ $this->fail('Should have raised an exception');
+ } catch (LogicException $e) {
+
+ }
}
}
diff --git a/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php b/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php
index 5cd45faf89..f9f7ce4e7d 100644
--- a/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php
+++ b/tests/Alchemy/Tests/Phrasea/Setup/Version/Migration/Migration38Test.php
@@ -202,13 +202,12 @@ class Migration38Test extends AbstractSetupTester
),
'authentication' => array(
'auto-create' => array(
- 'enabled' => false,
'templates' => array(
),
),
'captcha' => array(
'enabled' => true,
- 'trials-before-failure' => 9,
+ 'trials-before-display' => 9,
),
'providers' => array(
'facebook' => array(
diff --git a/www/include/geonames.feedback.php b/www/include/geonames.feedback.php
deleted file mode 100644
index 0fde0336a2..0000000000
--- a/www/include/geonames.feedback.php
+++ /dev/null
@@ -1,32 +0,0 @@
-get_parms('action', 'city');
-
-$action = $parm['action'];
-
-switch ($action) {
- case 'FIND':
- $output = $app['twig']->render('geonames/city_list.html.twig', array('geonames' => $app['geonames']->find_city($parm['city'])));
- break;
-}
-
-
-echo $output;
-