From 0f30f48b937eddc9b1130049403a5ff09e1041c0 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sat, 26 Sep 2015 19:35:00 +0200 Subject: Enabled created user from Config By default, creating user with FOSUser are disabled by default. Fix #1423 --- src/Wallabag/CoreBundle/Controller/ConfigController.php | 2 ++ src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php | 8 ++++++++ 2 files changed, 10 insertions(+) (limited to 'src/Wallabag/CoreBundle') diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php index 73484d86..5affdee8 100644 --- a/src/Wallabag/CoreBundle/Controller/ConfigController.php +++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php @@ -98,6 +98,8 @@ class ConfigController extends Controller // handle adding new user $newUser = new User(); + // enable created user by default + $newUser->setEnabled(true); $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile'))); $newUserForm->handleRequest($request); diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php index 116eec60..3407fc5e 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php @@ -337,6 +337,14 @@ class ConfigControllerTest extends WallabagCoreTestCase $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertContains('User "wallace" added', $alert[0]); + + $em = $client->getContainer()->get('doctrine.orm.entity_manager'); + $user = $em + ->getRepository('WallabagCoreBundle:User') + ->findOneByUsername('wallace'); + + $this->assertTrue(false !== $user); + $this->assertTrue($user->isEnabled()); } public function testRssUpdateResetToken() -- cgit v1.2.3