diff options
Diffstat (limited to 'src/Wallabag')
9 files changed, 88 insertions, 95 deletions
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 1fee56ad..74bfe4dc 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php | |||
@@ -40,7 +40,7 @@ class WallabagRestController extends FOSRestController | |||
40 | 40 | ||
41 | private function validateAuthentication() | 41 | private function validateAuthentication() |
42 | { | 42 | { |
43 | if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) { | 43 | if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) { |
44 | throw new AccessDeniedException(); | 44 | throw new AccessDeniedException(); |
45 | } | 45 | } |
46 | } | 46 | } |
@@ -347,7 +347,7 @@ class WallabagRestController extends FOSRestController | |||
347 | */ | 347 | */ |
348 | private function validateUserAccess($requestUserId) | 348 | private function validateUserAccess($requestUserId) |
349 | { | 349 | { |
350 | $user = $this->get('security.context')->getToken()->getUser(); | 350 | $user = $this->get('security.token_storage')->getToken()->getUser(); |
351 | if ($requestUserId != $user->getId()) { | 351 | if ($requestUserId != $user->getId()) { |
352 | throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); | 352 | throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); |
353 | } | 353 | } |
diff --git a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php index 119889b3..09cde0f6 100644 --- a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php +++ b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php | |||
@@ -25,7 +25,6 @@ abstract class AbstractControllerTest extends WebTestCase | |||
25 | $client = static::createClient(); | 25 | $client = static::createClient(); |
26 | $container = $client->getContainer(); | 26 | $container = $client->getContainer(); |
27 | 27 | ||
28 | $session = $container->get('session'); | ||
29 | /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ | 28 | /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ |
30 | $userManager = $container->get('fos_user.user_manager'); | 29 | $userManager = $container->get('fos_user.user_manager'); |
31 | /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ | 30 | /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ |
@@ -36,9 +35,10 @@ abstract class AbstractControllerTest extends WebTestCase | |||
36 | $loginManager->loginUser($firewallName, $user); | 35 | $loginManager->loginUser($firewallName, $user); |
37 | 36 | ||
38 | // save the login token into the session and put it in a cookie | 37 | // save the login token into the session and put it in a cookie |
39 | $container->get('session')->set('_security_'.$firewallName, | 38 | $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken())); |
40 | serialize($container->get('security.context')->getToken())); | ||
41 | $container->get('session')->save(); | 39 | $container->get('session')->save(); |
40 | |||
41 | $session = $container->get('session'); | ||
42 | $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId())); | 42 | $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId())); |
43 | 43 | ||
44 | return $client; | 44 | return $client; |
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 6ebbd93c..808baaf6 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -8,6 +8,9 @@ use Symfony\Component\Console\Input\InputOption; | |||
8 | use Symfony\Component\Console\Input\ArrayInput; | 8 | use Symfony\Component\Console\Input\ArrayInput; |
9 | use Symfony\Component\Console\Output\OutputInterface; | 9 | use Symfony\Component\Console\Output\OutputInterface; |
10 | use Symfony\Component\Console\Output\NullOutput; | 10 | use Symfony\Component\Console\Output\NullOutput; |
11 | use Symfony\Component\Console\Question\Question; | ||
12 | use Symfony\Component\Console\Question\ConfirmationQuestion; | ||
13 | use Symfony\Component\Console\Helper\Table; | ||
11 | use Wallabag\UserBundle\Entity\User; | 14 | use Wallabag\UserBundle\Entity\User; |
12 | use Wallabag\CoreBundle\Entity\Config; | 15 | use Wallabag\CoreBundle\Entity\Config; |
13 | 16 | ||
@@ -85,10 +88,11 @@ class InstallCommand extends ContainerAwareCommand | |||
85 | } | 88 | } |
86 | $rows[] = array($label, $status, $help); | 89 | $rows[] = array($label, $status, $help); |
87 | 90 | ||
88 | $this->getHelper('table') | 91 | $table = new Table($this->defaultOutput); |
92 | $table | ||
89 | ->setHeaders(array('Checked', 'Status', 'Recommendation')) | 93 | ->setHeaders(array('Checked', 'Status', 'Recommendation')) |
90 | ->setRows($rows) | 94 | ->setRows($rows) |
91 | ->render($this->defaultOutput); | 95 | ->render(); |
92 | 96 | ||
93 | if (!$fulfilled) { | 97 | if (!$fulfilled) { |
94 | throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.'); | 98 | throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.'); |
@@ -130,9 +134,10 @@ class InstallCommand extends ContainerAwareCommand | |||
130 | return $this; | 134 | return $this; |
131 | } | 135 | } |
132 | 136 | ||
133 | $dialog = $this->getHelper('dialog'); | 137 | $questionHelper = $this->getHelper('question'); |
138 | $question = new ConfirmationQuestion('It appears that your database already exists. Would you like to reset it? (y/N)', false); | ||
134 | 139 | ||
135 | if ($dialog->askConfirmation($this->defaultOutput, '<question>It appears that your database already exists. Would you like to reset it? (y/N)</question> ', false)) { | 140 | if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) { |
136 | $this->defaultOutput->writeln('Droping database, creating database and schema'); | 141 | $this->defaultOutput->writeln('Droping database, creating database and schema'); |
137 | 142 | ||
138 | $this | 143 | $this |
@@ -141,7 +146,8 @@ class InstallCommand extends ContainerAwareCommand | |||
141 | ->runCommand('doctrine:schema:create') | 146 | ->runCommand('doctrine:schema:create') |
142 | ; | 147 | ; |
143 | } elseif ($this->isSchemaPresent()) { | 148 | } elseif ($this->isSchemaPresent()) { |
144 | if ($dialog->askConfirmation($this->defaultOutput, '<question>Seems like your database contains schema. Do you want to reset it? (y/N)</question> ', false)) { | 149 | $question = new ConfirmationQuestion('Seems like your database contains schema. Do you want to reset it? (y/N)', false); |
150 | if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) { | ||
145 | $this->defaultOutput->writeln('Droping schema and creating schema'); | 151 | $this->defaultOutput->writeln('Droping schema and creating schema'); |
146 | 152 | ||
147 | $this | 153 | $this |
@@ -160,17 +166,6 @@ class InstallCommand extends ContainerAwareCommand | |||
160 | $this->defaultOutput->writeln('Clearing the cache'); | 166 | $this->defaultOutput->writeln('Clearing the cache'); |
161 | $this->runCommand('cache:clear'); | 167 | $this->runCommand('cache:clear'); |
162 | 168 | ||
163 | /* | ||
164 | if ($this->getHelperSet()->get('dialog')->askConfirmation($this->defaultOutput, '<question>Load fixtures (Y/N)?</question>', false)) { | ||
165 | $doctrineConfig = $this->getContainer()->get('doctrine.orm.entity_manager')->getConnection()->getConfiguration(); | ||
166 | $logger = $doctrineConfig->getSQLLogger(); | ||
167 | // speed up fixture load | ||
168 | $doctrineConfig->setSQLLogger(null); | ||
169 | $this->runCommand('doctrine:fixtures:load'); | ||
170 | $doctrineConfig->setSQLLogger($logger); | ||
171 | } | ||
172 | */ | ||
173 | |||
174 | $this->defaultOutput->writeln(''); | 169 | $this->defaultOutput->writeln(''); |
175 | 170 | ||
176 | return $this; | 171 | return $this; |
@@ -180,9 +175,10 @@ class InstallCommand extends ContainerAwareCommand | |||
180 | { | 175 | { |
181 | $this->defaultOutput->writeln('<info><comment>Step 3 of 4.</comment> Administration setup.</info>'); | 176 | $this->defaultOutput->writeln('<info><comment>Step 3 of 4.</comment> Administration setup.</info>'); |
182 | 177 | ||
183 | $dialog = $this->getHelperSet()->get('dialog'); | 178 | $questionHelper = $this->getHelperSet()->get('question'); |
179 | $question = new ConfirmationQuestion('Would you like to create a new user ? (y/N)', false); | ||
184 | 180 | ||
185 | if (false === $dialog->askConfirmation($this->defaultOutput, '<question>Would you like to create a new user ? (y/N)</question>', true)) { | 181 | if (!$questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) { |
186 | return $this; | 182 | return $this; |
187 | } | 183 | } |
188 | 184 | ||
@@ -190,9 +186,16 @@ class InstallCommand extends ContainerAwareCommand | |||
190 | 186 | ||
191 | $userManager = $this->getContainer()->get('fos_user.user_manager'); | 187 | $userManager = $this->getContainer()->get('fos_user.user_manager'); |
192 | $user = $userManager->createUser(); | 188 | $user = $userManager->createUser(); |
193 | $user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag')); | 189 | |
194 | $user->setPlainPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag')); | 190 | $question = new Question('Username (default: wallabag) :', 'wallabag'); |
195 | $user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', '')); | 191 | $user->setUsername($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)); |
192 | |||
193 | $question = new Question('Password (default: wallabag) :', 'wallabag'); | ||
194 | $user->setPlainPassword($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)); | ||
195 | |||
196 | $question = new Question('Email:', ''); | ||
197 | $user->setEmail($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)); | ||
198 | |||
196 | $user->setEnabled(true); | 199 | $user->setEnabled(true); |
197 | 200 | ||
198 | $em->persist($user); | 201 | $em->persist($user); |
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index ca4acc6a..8bbe4ca0 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php | |||
@@ -29,7 +29,7 @@ class ConfigController extends Controller | |||
29 | $user = $this->getUser(); | 29 | $user = $this->getUser(); |
30 | 30 | ||
31 | // handle basic config detail (this form is defined as a service) | 31 | // handle basic config detail (this form is defined as a service) |
32 | $configForm = $this->createForm('config', $config); | 32 | $configForm = $this->createForm('config', $config, array('action' => $this->generateUrl('config'))); |
33 | $configForm->handleRequest($request); | 33 | $configForm->handleRequest($request); |
34 | 34 | ||
35 | if ($configForm->isValid()) { | 35 | if ($configForm->isValid()) { |
@@ -49,7 +49,7 @@ class ConfigController extends Controller | |||
49 | } | 49 | } |
50 | 50 | ||
51 | // handle changing password | 51 | // handle changing password |
52 | $pwdForm = $this->createForm(new ChangePasswordType()); | 52 | $pwdForm = $this->createForm(new ChangePasswordType(), null, array('action' => $this->generateUrl('config').'#set4')); |
53 | $pwdForm->handleRequest($request); | 53 | $pwdForm->handleRequest($request); |
54 | 54 | ||
55 | if ($pwdForm->isValid()) { | 55 | if ($pwdForm->isValid()) { |
@@ -65,7 +65,10 @@ class ConfigController extends Controller | |||
65 | } | 65 | } |
66 | 66 | ||
67 | // handle changing user information | 67 | // handle changing user information |
68 | $userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile'))); | 68 | $userForm = $this->createForm(new UserInformationType(), $user, array( |
69 | 'validation_groups' => array('Profile'), | ||
70 | 'action' => $this->generateUrl('config').'#set3', | ||
71 | )); | ||
69 | $userForm->handleRequest($request); | 72 | $userForm->handleRequest($request); |
70 | 73 | ||
71 | if ($userForm->isValid()) { | 74 | if ($userForm->isValid()) { |
@@ -80,7 +83,7 @@ class ConfigController extends Controller | |||
80 | } | 83 | } |
81 | 84 | ||
82 | // handle rss information | 85 | // handle rss information |
83 | $rssForm = $this->createForm(new RssType(), $config); | 86 | $rssForm = $this->createForm(new RssType(), $config, array('action' => $this->generateUrl('config').'#set2')); |
84 | $rssForm->handleRequest($request); | 87 | $rssForm->handleRequest($request); |
85 | 88 | ||
86 | if ($rssForm->isValid()) { | 89 | if ($rssForm->isValid()) { |
@@ -99,7 +102,10 @@ class ConfigController extends Controller | |||
99 | $newUser = $userManager->createUser(); | 102 | $newUser = $userManager->createUser(); |
100 | // enable created user by default | 103 | // enable created user by default |
101 | $newUser->setEnabled(true); | 104 | $newUser->setEnabled(true); |
102 | $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile'))); | 105 | $newUserForm = $this->createForm(new NewUserType(), $newUser, array( |
106 | 'validation_groups' => array('Profile'), | ||
107 | 'action' => $this->generateUrl('config').'#set5', | ||
108 | )); | ||
103 | $newUserForm->handleRequest($request); | 109 | $newUserForm->handleRequest($request); |
104 | 110 | ||
105 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { | 111 | if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { |
diff --git a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php index 054a3752..23e98042 100644 --- a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php +++ b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php | |||
@@ -3,7 +3,7 @@ | |||
3 | namespace Wallabag\CoreBundle\Helper; | 3 | namespace Wallabag\CoreBundle\Helper; |
4 | 4 | ||
5 | use Liip\ThemeBundle\Helper\DeviceDetectionInterface; | 5 | use Liip\ThemeBundle\Helper\DeviceDetectionInterface; |
6 | use Symfony\Component\Security\Core\SecurityContextInterface; | 6 | use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface; |
7 | use Wallabag\UserBundle\Entity\User; | 7 | use Wallabag\UserBundle\Entity\User; |
8 | 8 | ||
9 | /** | 9 | /** |
@@ -14,16 +14,16 @@ use Wallabag\UserBundle\Entity\User; | |||
14 | */ | 14 | */ |
15 | class DetectActiveTheme implements DeviceDetectionInterface | 15 | class DetectActiveTheme implements DeviceDetectionInterface |
16 | { | 16 | { |
17 | protected $securityContext; | 17 | protected $tokenStorage; |
18 | protected $defaultTheme; | 18 | protected $defaultTheme; |
19 | 19 | ||
20 | /** | 20 | /** |
21 | * @param SecurityContextInterface $securityContext Needed to retrieve the current user | 21 | * @param TokenStorageInterface $tokenStorage Needed to retrieve the current user |
22 | * @param string $defaultTheme Default theme when user isn't logged in | 22 | * @param string $defaultTheme Default theme when user isn't logged in |
23 | */ | 23 | */ |
24 | public function __construct(SecurityContextInterface $securityContext, $defaultTheme) | 24 | public function __construct(TokenStorageInterface $tokenStorage, $defaultTheme) |
25 | { | 25 | { |
26 | $this->securityContext = $securityContext; | 26 | $this->tokenStorage = $tokenStorage; |
27 | $this->defaultTheme = $defaultTheme; | 27 | $this->defaultTheme = $defaultTheme; |
28 | } | 28 | } |
29 | 29 | ||
@@ -42,7 +42,7 @@ class DetectActiveTheme implements DeviceDetectionInterface | |||
42 | */ | 42 | */ |
43 | public function getType() | 43 | public function getType() |
44 | { | 44 | { |
45 | $token = $this->securityContext->getToken(); | 45 | $token = $this->tokenStorage->getToken(); |
46 | 46 | ||
47 | if (is_null($token)) { | 47 | if (is_null($token)) { |
48 | return $this->defaultTheme; | 48 | return $this->defaultTheme; |
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 3c479ff6..debbf39e 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -2,7 +2,7 @@ services: | |||
2 | wallabag_core.helper.detect_active_theme: | 2 | wallabag_core.helper.detect_active_theme: |
3 | class: Wallabag\CoreBundle\Helper\DetectActiveTheme | 3 | class: Wallabag\CoreBundle\Helper\DetectActiveTheme |
4 | arguments: | 4 | arguments: |
5 | - @security.context | 5 | - @security.token_storage |
6 | - %theme% # default theme from parameters.yml | 6 | - %theme% # default theme from parameters.yml |
7 | 7 | ||
8 | # custom form type | 8 | # custom form type |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig index abe5dc9e..7a7d6af1 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig | |||
@@ -5,7 +5,7 @@ | |||
5 | {% block content %} | 5 | {% block content %} |
6 | <h2>{% trans %}Wallabag configuration{% endtrans %}</h2> | 6 | <h2>{% trans %}Wallabag configuration{% endtrans %}</h2> |
7 | 7 | ||
8 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}> | 8 | {{ form_start(form.config) }} |
9 | {{ form_errors(form.config) }} | 9 | {{ form_errors(form.config) }} |
10 | 10 | ||
11 | <fieldset class="w500p inline"> | 11 | <fieldset class="w500p inline"> |
@@ -37,7 +37,7 @@ | |||
37 | 37 | ||
38 | <h2>{% trans %}RSS configuration{% endtrans %}</h2> | 38 | <h2>{% trans %}RSS configuration{% endtrans %}</h2> |
39 | 39 | ||
40 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.rss) }}> | 40 | {{ form_start(form.rss) }} |
41 | {{ form_errors(form.rss) }} | 41 | {{ form_errors(form.rss) }} |
42 | 42 | ||
43 | <fieldset class="w500p inline"> | 43 | <fieldset class="w500p inline"> |
@@ -81,7 +81,7 @@ | |||
81 | 81 | ||
82 | <h2>{% trans %}User information{% endtrans %}</h2> | 82 | <h2>{% trans %}User information{% endtrans %}</h2> |
83 | 83 | ||
84 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.user) }}> | 84 | {{ form_start(form.user) }} |
85 | {{ form_errors(form.user) }} | 85 | {{ form_errors(form.user) }} |
86 | 86 | ||
87 | <fieldset class="w500p inline"> | 87 | <fieldset class="w500p inline"> |
@@ -115,7 +115,7 @@ | |||
115 | 115 | ||
116 | <h2>{% trans %}Change your password{% endtrans %}</h2> | 116 | <h2>{% trans %}Change your password{% endtrans %}</h2> |
117 | 117 | ||
118 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.pwd) }}> | 118 | {{ form_start(form.pwd) }} |
119 | {{ form_errors(form.pwd) }} | 119 | {{ form_errors(form.pwd) }} |
120 | 120 | ||
121 | <fieldset class="w500p inline"> | 121 | <fieldset class="w500p inline"> |
@@ -148,7 +148,7 @@ | |||
148 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 148 | {% if is_granted('ROLE_SUPER_ADMIN') %} |
149 | <h2>{% trans %}Add a user{% endtrans %}</h2> | 149 | <h2>{% trans %}Add a user{% endtrans %}</h2> |
150 | 150 | ||
151 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.new_user) }}> | 151 | {{ form_start(form.new_user) }} |
152 | {{ form_errors(form.new_user) }} | 152 | {{ form_errors(form.new_user) }} |
153 | 153 | ||
154 | <fieldset class="w500p inline"> | 154 | <fieldset class="w500p inline"> |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig index ab24d4ef..8f121a2b 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig | |||
@@ -21,9 +21,8 @@ | |||
21 | </ul> | 21 | </ul> |
22 | </div> | 22 | </div> |
23 | 23 | ||
24 | |||
25 | <div id="set1" class="col s12"> | 24 | <div id="set1" class="col s12"> |
26 | <form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}> | 25 | {{ form_start(form.config) }} |
27 | {{ form_errors(form.config) }} | 26 | {{ form_errors(form.config) }} |
28 | 27 | ||
29 | <div class="row"> | 28 | <div class="row"> |
@@ -57,9 +56,8 @@ | |||
57 | </form> | 56 | </form> |
58 | </div> | 57 | </div> |
59 | 58 | ||
60 | |||
61 | <div id="set2" class="col s12"> | 59 | <div id="set2" class="col s12"> |
62 | <form action="{{ path('config') }}#set2" method="post" {{ form_enctype(form.rss) }}> | 60 | {{ form_start(form.rss) }} |
63 | {{ form_errors(form.rss) }} | 61 | {{ form_errors(form.rss) }} |
64 | 62 | ||
65 | <div class="row"> | 63 | <div class="row"> |
@@ -111,9 +109,8 @@ | |||
111 | </form> | 109 | </form> |
112 | </div> | 110 | </div> |
113 | 111 | ||
114 | |||
115 | <div id="set3" class="col s12"> | 112 | <div id="set3" class="col s12"> |
116 | <form action="{{ path('config') }}#set3" method="post" {{ form_enctype(form.user) }}> | 113 | {{ form_start(form.user) }} |
117 | {{ form_errors(form.user) }} | 114 | {{ form_errors(form.user) }} |
118 | 115 | ||
119 | <div class="row"> | 116 | <div class="row"> |
@@ -150,9 +147,8 @@ | |||
150 | </form> | 147 | </form> |
151 | </div> | 148 | </div> |
152 | 149 | ||
153 | |||
154 | <div id="set4" class="col s12"> | 150 | <div id="set4" class="col s12"> |
155 | <form action="{{ path('config') }}#set4" method="post" {{ form_enctype(form.pwd) }}> | 151 | {{ form_start(form.pwd) }} |
156 | {{ form_errors(form.pwd) }} | 152 | {{ form_errors(form.pwd) }} |
157 | 153 | ||
158 | <div class="row"> | 154 | <div class="row"> |
@@ -189,7 +185,7 @@ | |||
189 | 185 | ||
190 | {% if is_granted('ROLE_SUPER_ADMIN') %} | 186 | {% if is_granted('ROLE_SUPER_ADMIN') %} |
191 | <div id="set5" class="col s12"> | 187 | <div id="set5" class="col s12"> |
192 | <form action="{{ path('config') }}#set5" method="post" {{ form_enctype(form.new_user) }}> | 188 | {{ form_start(form.new_user) }} |
193 | {{ form_errors(form.new_user) }} | 189 | {{ form_errors(form.new_user) }} |
194 | 190 | ||
195 | <div class="row"> | 191 | <div class="row"> |
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php index 24910e60..e98dd202 100644 --- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php +++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php | |||
@@ -35,19 +35,16 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
35 | 35 | ||
36 | $command = $application->find('wallabag:install'); | 36 | $command = $application->find('wallabag:install'); |
37 | 37 | ||
38 | // We mock the DialogHelper | 38 | // We mock the QuestionHelper |
39 | $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') | 39 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') |
40 | ->disableOriginalConstructor() | 40 | ->disableOriginalConstructor() |
41 | ->getMock(); | 41 | ->getMock(); |
42 | $dialog->expects($this->any()) | 42 | $question->expects($this->any()) |
43 | ->method('ask') | 43 | ->method('ask') |
44 | ->will($this->returnValue('test_'.uniqid('', true))); | 44 | ->will($this->returnValue('yes_'.uniqid('', true))); |
45 | $dialog->expects($this->any()) | ||
46 | ->method('askConfirmation') | ||
47 | ->will($this->returnValue(true)); | ||
48 | 45 | ||
49 | // We override the standard helper with our mock | 46 | // We override the standard helper with our mock |
50 | $command->getHelperSet()->set($dialog, 'dialog'); | 47 | $command->getHelperSet()->set($question, 'question'); |
51 | 48 | ||
52 | $tester = new CommandTester($command); | 49 | $tester = new CommandTester($command); |
53 | $tester->execute(array( | 50 | $tester->execute(array( |
@@ -69,19 +66,16 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
69 | 66 | ||
70 | $command = $application->find('wallabag:install'); | 67 | $command = $application->find('wallabag:install'); |
71 | 68 | ||
72 | // We mock the DialogHelper | 69 | // We mock the QuestionHelper |
73 | $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') | 70 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') |
74 | ->disableOriginalConstructor() | 71 | ->disableOriginalConstructor() |
75 | ->getMock(); | 72 | ->getMock(); |
76 | $dialog->expects($this->any()) | 73 | $question->expects($this->any()) |
77 | ->method('ask') | 74 | ->method('ask') |
78 | ->will($this->returnValue('test_'.uniqid('', true))); | 75 | ->will($this->returnValue('yes_'.uniqid('', true))); |
79 | $dialog->expects($this->any()) | ||
80 | ->method('askConfirmation') | ||
81 | ->will($this->returnValue(true)); | ||
82 | 76 | ||
83 | // We override the standard helper with our mock | 77 | // We override the standard helper with our mock |
84 | $command->getHelperSet()->set($dialog, 'dialog'); | 78 | $command->getHelperSet()->set($question, 'question'); |
85 | 79 | ||
86 | $tester = new CommandTester($command); | 80 | $tester = new CommandTester($command); |
87 | $tester->execute(array( | 81 | $tester->execute(array( |
@@ -119,19 +113,16 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
119 | 113 | ||
120 | $command = $application->find('wallabag:install'); | 114 | $command = $application->find('wallabag:install'); |
121 | 115 | ||
122 | // We mock the DialogHelper | 116 | // We mock the QuestionHelper |
123 | $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') | 117 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') |
124 | ->disableOriginalConstructor() | 118 | ->disableOriginalConstructor() |
125 | ->getMock(); | 119 | ->getMock(); |
126 | $dialog->expects($this->any()) | 120 | $question->expects($this->any()) |
127 | ->method('ask') | 121 | ->method('ask') |
128 | ->will($this->returnValue('test_'.uniqid('', true))); | 122 | ->will($this->returnValue('yes_'.uniqid('', true))); |
129 | $dialog->expects($this->any()) | ||
130 | ->method('askConfirmation') | ||
131 | ->will($this->returnValue(true)); | ||
132 | 123 | ||
133 | // We override the standard helper with our mock | 124 | // We override the standard helper with our mock |
134 | $command->getHelperSet()->set($dialog, 'dialog'); | 125 | $command->getHelperSet()->set($question, 'question'); |
135 | 126 | ||
136 | $tester = new CommandTester($command); | 127 | $tester = new CommandTester($command); |
137 | $tester->execute(array( | 128 | $tester->execute(array( |
@@ -156,13 +147,13 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
156 | 147 | ||
157 | $command = $application->find('wallabag:install'); | 148 | $command = $application->find('wallabag:install'); |
158 | 149 | ||
159 | // We mock the DialogHelper | 150 | // We mock the QuestionHelper |
160 | $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') | 151 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') |
161 | ->disableOriginalConstructor() | 152 | ->disableOriginalConstructor() |
162 | ->getMock(); | 153 | ->getMock(); |
163 | 154 | ||
164 | $dialog->expects($this->exactly(3)) | 155 | $question->expects($this->exactly(3)) |
165 | ->method('askConfirmation') | 156 | ->method('ask') |
166 | ->will($this->onConsecutiveCalls( | 157 | ->will($this->onConsecutiveCalls( |
167 | false, // don't want to reset the entire database | 158 | false, // don't want to reset the entire database |
168 | true, // do want to reset the schema | 159 | true, // do want to reset the schema |
@@ -170,7 +161,7 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
170 | )); | 161 | )); |
171 | 162 | ||
172 | // We override the standard helper with our mock | 163 | // We override the standard helper with our mock |
173 | $command->getHelperSet()->set($dialog, 'dialog'); | 164 | $command->getHelperSet()->set($question, 'question'); |
174 | 165 | ||
175 | $tester = new CommandTester($command); | 166 | $tester = new CommandTester($command); |
176 | $tester->execute(array( | 167 | $tester->execute(array( |
@@ -216,20 +207,20 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
216 | 207 | ||
217 | $command = $application->find('wallabag:install'); | 208 | $command = $application->find('wallabag:install'); |
218 | 209 | ||
219 | // We mock the DialogHelper | 210 | // We mock the QuestionHelper |
220 | $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') | 211 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') |
221 | ->disableOriginalConstructor() | 212 | ->disableOriginalConstructor() |
222 | ->getMock(); | 213 | ->getMock(); |
223 | 214 | ||
224 | $dialog->expects($this->exactly(2)) | 215 | $question->expects($this->exactly(2)) |
225 | ->method('askConfirmation') | 216 | ->method('ask') |
226 | ->will($this->onConsecutiveCalls( | 217 | ->will($this->onConsecutiveCalls( |
227 | false, // don't want to reset the entire database | 218 | false, // don't want to reset the entire database |
228 | false // don't want to create a new user | 219 | false // don't want to create a new user |
229 | )); | 220 | )); |
230 | 221 | ||
231 | // We override the standard helper with our mock | 222 | // We override the standard helper with our mock |
232 | $command->getHelperSet()->set($dialog, 'dialog'); | 223 | $command->getHelperSet()->set($question, 'question'); |
233 | 224 | ||
234 | $tester = new CommandTester($command); | 225 | $tester = new CommandTester($command); |
235 | $tester->execute(array( | 226 | $tester->execute(array( |
@@ -253,19 +244,16 @@ class InstallCommandTest extends WallabagCoreTestCase | |||
253 | 244 | ||
254 | $command = $application->find('wallabag:install'); | 245 | $command = $application->find('wallabag:install'); |
255 | 246 | ||
256 | // We mock the DialogHelper | 247 | // We mock the QuestionHelper |
257 | $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') | 248 | $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper') |
258 | ->disableOriginalConstructor() | 249 | ->disableOriginalConstructor() |
259 | ->getMock(); | 250 | ->getMock(); |
260 | $dialog->expects($this->any()) | 251 | $question->expects($this->any()) |
261 | ->method('ask') | 252 | ->method('ask') |
262 | ->will($this->returnValue('test_'.uniqid('', true))); | 253 | ->will($this->returnValue('yes_'.uniqid('', true))); |
263 | $dialog->expects($this->any()) | ||
264 | ->method('askConfirmation') | ||
265 | ->will($this->returnValue(true)); | ||
266 | 254 | ||
267 | // We override the standard helper with our mock | 255 | // We override the standard helper with our mock |
268 | $command->getHelperSet()->set($dialog, 'dialog'); | 256 | $command->getHelperSet()->set($question, 'question'); |
269 | 257 | ||
270 | $tester = new CommandTester($command); | 258 | $tester = new CommandTester($command); |
271 | $tester->execute(array( | 259 | $tester->execute(array( |