aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle')
-rw-r--r--src/Wallabag/UserBundle/Controller/ResettingController.php75
-rw-r--r--src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php50
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php204
-rw-r--r--src/Wallabag/UserBundle/Repository/UserRepository.php26
-rw-r--r--src/Wallabag/UserBundle/Resources/config/services.yml0
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig20
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig37
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig17
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig20
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig17
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig33
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/layout.html.twig16
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig12
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig11
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig17
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig45
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig11
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig11
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig26
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig15
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig46
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig23
-rw-r--r--src/Wallabag/UserBundle/WallabagUserBundle.php13
23 files changed, 745 insertions, 0 deletions
diff --git a/src/Wallabag/UserBundle/Controller/ResettingController.php b/src/Wallabag/UserBundle/Controller/ResettingController.php
new file mode 100644
index 00000000..8aa1e230
--- /dev/null
+++ b/src/Wallabag/UserBundle/Controller/ResettingController.php
@@ -0,0 +1,75 @@
1<?php
2
3namespace Wallabag\UserBundle\Controller;
4
5use FOS\UserBundle\FOSUserEvents;
6use FOS\UserBundle\Event\FormEvent;
7use FOS\UserBundle\Event\GetResponseUserEvent;
8use FOS\UserBundle\Event\FilterUserResponseEvent;
9use Symfony\Component\HttpFoundation\Request;
10use Symfony\Component\HttpFoundation\RedirectResponse;
11use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
12
13class ResettingController extends \FOS\UserBundle\Controller\ResettingController
14{
15 /**
16 * Extends ResettingController to change the redirection after success.
17 *
18 * @param Request $request
19 * @param $token
20 *
21 * @return null|RedirectResponse|\Symfony\Component\HttpFoundation\Response
22 */
23 public function resetAction(Request $request, $token)
24 {
25 /** @var $formFactory \FOS\UserBundle\Form\Factory\FactoryInterface */
26 $formFactory = $this->get('fos_user.resetting.form.factory');
27 /** @var $userManager \FOS\UserBundle\Model\UserManagerInterface */
28 $userManager = $this->get('fos_user.user_manager');
29 /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */
30 $dispatcher = $this->get('event_dispatcher');
31
32 $user = $userManager->findUserByConfirmationToken($token);
33
34 if (null === $user) {
35 throw new NotFoundHttpException(sprintf('The user with "confirmation token" does not exist for value "%s"', $token));
36 }
37
38 $event = new GetResponseUserEvent($user, $request);
39 $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_INITIALIZE, $event);
40
41 if (null !== $event->getResponse()) {
42 return $event->getResponse();
43 }
44
45 $form = $formFactory->createForm();
46 $form->setData($user);
47
48 $form->handleRequest($request);
49
50 if ($form->isValid()) {
51 $event = new FormEvent($form, $request);
52 $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_SUCCESS, $event);
53
54 $userManager->updateUser($user);
55
56 if (null === $response = $event->getResponse()) {
57 $this->get('session')->getFlashBag()->add(
58 'notice',
59 'Password updated'
60 );
61 $url = $this->generateUrl('homepage');
62 $response = new RedirectResponse($url);
63 }
64
65 $dispatcher->dispatch(FOSUserEvents::RESETTING_RESET_COMPLETED, new FilterUserResponseEvent($user, $request, $response));
66
67 return $response;
68 }
69
70 return $this->render('FOSUserBundle:Resetting:reset.html.twig', array(
71 'token' => $token,
72 'form' => $form->createView(),
73 ));
74 }
75}
diff --git a/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php
new file mode 100644
index 00000000..d48855da
--- /dev/null
+++ b/src/Wallabag/UserBundle/DataFixtures/ORM/LoadUserData.php
@@ -0,0 +1,50 @@
1<?php
2
3namespace Wallabag\UserBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\UserBundle\Entity\User;
9
10class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
11{
12 /**
13 * {@inheritdoc}
14 */
15 public function load(ObjectManager $manager)
16 {
17 $userAdmin = new User();
18 $userAdmin->setName('Big boss');
19 $userAdmin->setEmail('bigboss@wallabag.org');
20 $userAdmin->setUsername('admin');
21 $userAdmin->setPlainPassword('mypassword');
22 $userAdmin->setEnabled(true);
23 $userAdmin->addRole('ROLE_SUPER_ADMIN');
24
25 $manager->persist($userAdmin);
26
27 $this->addReference('admin-user', $userAdmin);
28
29 $bobUser = new User();
30 $bobUser->setName('Bobby');
31 $bobUser->setEmail('bobby@wallabag.org');
32 $bobUser->setUsername('bob');
33 $bobUser->setPlainPassword('mypassword');
34 $bobUser->setEnabled(true);
35
36 $manager->persist($bobUser);
37
38 $this->addReference('bob-user', $bobUser);
39
40 $manager->flush();
41 }
42
43 /**
44 * {@inheritdoc}
45 */
46 public function getOrder()
47 {
48 return 10;
49 }
50}
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
new file mode 100644
index 00000000..8f02e070
--- /dev/null
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -0,0 +1,204 @@
1<?php
2
3namespace Wallabag\UserBundle\Entity;
4
5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\ORM\Mapping as ORM;
7use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8use Symfony\Component\Security\Core\User\UserInterface;
9use JMS\Serializer\Annotation\ExclusionPolicy;
10use JMS\Serializer\Annotation\Expose;
11use FOS\UserBundle\Model\User as BaseUser;
12use Wallabag\CoreBundle\Entity\Config;
13use Wallabag\CoreBundle\Entity\Entry;
14use Wallabag\CoreBundle\Entity\Tag;
15
16/**
17 * User.
18 *
19 * @ORM\Entity(repositoryClass="Wallabag\UserBundle\Repository\UserRepository")
20 * @ORM\Table
21 * @ORM\HasLifecycleCallbacks()
22 * @ExclusionPolicy("all")
23 *
24 * @UniqueEntity("email")
25 * @UniqueEntity("username")
26 */
27class User extends BaseUser
28{
29 /**
30 * @var int
31 *
32 * @Expose
33 * @ORM\Column(name="id", type="integer")
34 * @ORM\Id
35 * @ORM\GeneratedValue(strategy="AUTO")
36 */
37 protected $id;
38
39 /**
40 * @var string
41 *
42 * @ORM\Column(name="name", type="text", nullable=true)
43 */
44 protected $name;
45
46 /**
47 * @var date
48 *
49 * @ORM\Column(name="created_at", type="datetime")
50 */
51 protected $createdAt;
52
53 /**
54 * @var date
55 *
56 * @ORM\Column(name="updated_at", type="datetime")
57 */
58 protected $updatedAt;
59
60 /**
61 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\Entry", mappedBy="user", cascade={"remove"})
62 */
63 protected $entries;
64
65 /**
66 * @ORM\OneToOne(targetEntity="Wallabag\CoreBundle\Entity\Config", mappedBy="user")
67 */
68 protected $config;
69
70 /**
71 * @ORM\OneToMany(targetEntity="Wallabag\CoreBundle\Entity\Tag", mappedBy="user", cascade={"remove"})
72 */
73 protected $tags;
74
75 public function __construct()
76 {
77 parent::__construct();
78 $this->entries = new ArrayCollection();
79 $this->tags = new ArrayCollection();
80 $this->roles = array('ROLE_USER');
81 }
82
83 /**
84 * @ORM\PrePersist
85 * @ORM\PreUpdate
86 */
87 public function timestamps()
88 {
89 if (is_null($this->createdAt)) {
90 $this->createdAt = new \DateTime();
91 }
92
93 $this->updatedAt = new \DateTime();
94 }
95
96 /**
97 * Set name.
98 *
99 * @param string $name
100 *
101 * @return User
102 */
103 public function setName($name)
104 {
105 $this->name = $name;
106
107 return $this;
108 }
109
110 /**
111 * Get name.
112 *
113 * @return string
114 */
115 public function getName()
116 {
117 return $this->name;
118 }
119
120 /**
121 * @return string
122 */
123 public function getCreatedAt()
124 {
125 return $this->createdAt;
126 }
127
128 /**
129 * @return string
130 */
131 public function getUpdatedAt()
132 {
133 return $this->updatedAt;
134 }
135
136 /**
137 * @param Entry $entry
138 *
139 * @return User
140 */
141 public function addEntry(Entry $entry)
142 {
143 $this->entries[] = $entry;
144
145 return $this;
146 }
147
148 /**
149 * @return ArrayCollection<Entry>
150 */
151 public function getEntries()
152 {
153 return $this->entries;
154 }
155
156 /**
157 * @param Entry $entry
158 *
159 * @return User
160 */
161 public function addTag(Tag $tag)
162 {
163 $this->tags[] = $tag;
164
165 return $this;
166 }
167
168 /**
169 * @return ArrayCollection<Tag>
170 */
171 public function getTags()
172 {
173 return $this->tags;
174 }
175
176 public function isEqualTo(UserInterface $user)
177 {
178 return $this->username === $user->getUsername();
179 }
180
181 /**
182 * Set config.
183 *
184 * @param Config $config
185 *
186 * @return User
187 */
188 public function setConfig(Config $config = null)
189 {
190 $this->config = $config;
191
192 return $this;
193 }
194
195 /**
196 * Get config.
197 *
198 * @return Config
199 */
200 public function getConfig()
201 {
202 return $this->config;
203 }
204}
diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php
new file mode 100644
index 00000000..c020f3ca
--- /dev/null
+++ b/src/Wallabag/UserBundle/Repository/UserRepository.php
@@ -0,0 +1,26 @@
1<?php
2
3namespace Wallabag\UserBundle\Repository;
4
5use Doctrine\ORM\EntityRepository;
6
7class UserRepository extends EntityRepository
8{
9 /**
10 * Find a user by its username and rss roken.
11 *
12 * @param string $username
13 * @param string $rssToken
14 *
15 * @return User|null
16 */
17 public function findOneByUsernameAndRsstoken($username, $rssToken)
18 {
19 return $this->createQueryBuilder('u')
20 ->leftJoin('u.config', 'c')
21 ->where('c.rssToken = :rss_token')->setParameter('rss_token', $rssToken)
22 ->andWhere('u.username = :username')->setParameter('username', $username)
23 ->getQuery()
24 ->getOneOrNullResult();
25 }
26}
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig
new file mode 100644
index 00000000..e5c1876b
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register.html.twig
@@ -0,0 +1,20 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}create an account{% endtrans %}{% endblock %}
4
5{% block body_class %}login{% endblock %}
6
7{% block menu %}{% endblock %}
8{% block messages %}{% endblock %}
9
10{% block content %}
11 <form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
12 <fieldset class="w500p center">
13 <h2 class="mbs txtcenter">{% trans %}create an account{% endtrans %}</h2>
14 {% include "FOSUserBundle:Registration:register_content.html.twig" %}
15 </fieldset>
16 </form>
17{% endblock %}
18
19{% block footer %}
20{% endblock %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig
new file mode 100644
index 00000000..41f94006
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Registration/register_content.html.twig
@@ -0,0 +1,37 @@
1{% trans_default_domain 'FOSUserBundle' %}
2
3{{ form_widget(form._token) }}
4
5{% for flashMessage in app.session.flashbag.get('notice') %}
6 <span><p>{{ flashMessage }}</p></span>
7{% endfor %}
8
9<div class="row">
10 {{ form_errors(form.email) }}
11 {{ form_label(form.email) }}
12 {{ form_widget(form.email) }}
13</div>
14
15<div class="row">
16 {{ form_errors(form.username) }}
17 {{ form_label(form.username) }}
18 {{ form_widget(form.username) }}
19</div>
20
21<div class="row">
22 {{ form_errors(form.plainPassword.first) }}
23 {{ form_label(form.plainPassword.first) }}
24 {{ form_widget(form.plainPassword.first) }}
25</div>
26
27<div class="row">
28 {{ form_errors(form.plainPassword.second) }}
29 {{ form_label(form.plainPassword.second) }}
30 {{ form_widget(form.plainPassword.second) }}
31</div>
32
33
34<div class="row mts txtcenter">
35 <button type="submit">{{ 'registration.submit'|trans({}, 'FOSUserBundle') }}</button>
36 <a href="{{ path('fos_user_security_login') }}" class="button">{% trans %}Login{% endtrans %}</a>
37</div>
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig
new file mode 100644
index 00000000..056d65b5
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/checkEmail.html.twig
@@ -0,0 +1,17 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %}
4
5{% block body_class %}login{% endblock %}
6
7{% block menu %}{% endblock %}
8
9{% block content %}
10 <form>
11 <fieldset class="w500p center">
12 <h2 class="mbs txtcenter">{% trans %}Forgot password{% endtrans %}</h2>
13
14 <p>{{ 'An email has been sent to %email%. It contains a link you must click to reset your password.'|trans({'%email%': email}) }}</p>
15 </fieldset>
16 </form>
17{% endblock %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig
new file mode 100644
index 00000000..10094e83
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request.html.twig
@@ -0,0 +1,20 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{% trans %}Forgot password{% endtrans %}{% endblock %}
4
5{% block body_class %}login{% endblock %}
6
7{% block menu %}{% endblock %}
8{% block messages %}{% endblock %}
9
10{% block content %}
11 <form action="{{ path('fos_user_resetting_send_email') }}" method="post" name="forgotPasswordform">
12 <fieldset class="w500p center">
13 <h2 class="mbs txtcenter">{% trans %}Forgot password{% endtrans %}</h2>
14 {% include "FOSUserBundle:Resetting:request_content.html.twig" %}
15 </fieldset>
16 </form>
17{% endblock %}
18
19{% block footer %}
20{% endblock %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig
new file mode 100644
index 00000000..1f8da8d7
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Resetting/request_content.html.twig
@@ -0,0 +1,17 @@
1{% trans_default_domain 'FOSUserBundle' %}
2
3{% trans %}Enter your email address below and we'll send you password reset instructions.{% endtrans %}
4
5{% if invalid_username is defined %}
6 <p>{{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}) }}</p>
7{% endif %}
8
9<div class="row">
10 <label for="username">{{ 'resetting.request.username'|trans }}</label>
11 <input type="text" id="username" name="username" required="required" />
12</div>
13
14<div class="row mts txtcenter">
15 <button type="submit">{{ 'resetting.request.submit'|trans }}</button>
16 <a href="{{ path('fos_user_security_login') }}" class="button">{% trans %}Login{% endtrans %}</a>
17</div>
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig
new file mode 100644
index 00000000..d52c3662
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Security/login.html.twig
@@ -0,0 +1,33 @@
1{% extends "FOSUserBundle::layout.html.twig" %}
2
3{% block fos_user_content %}
4 <form action="{{ path('fos_user_security_check') }}" method="post" name="loginform">
5 <fieldset class="w500p center">
6 <h2 class="mbs txtcenter">{% trans %}Login to wallabag{% endtrans %}</h2>
7 {% if error %}
8 <div>{{ error.message }}</div>
9 {% endif %}
10
11 {% for flashMessage in app.session.flashbag.get('notice') %}
12 <p>{{ flashMessage }}</p>
13 {% endfor %}
14
15 <div class="row">
16 <label class="col w150p" for="username">{% trans %}Username{% endtrans %}</label>
17 <input type="text" id="username" name="_username" value="{{ last_username }}" />
18 </div>
19
20 <div class="row">
21 <label class="col w150p" for="password">{% trans %}Password{% endtrans %}</label>
22 <input type="password" id="password" name="_password" />
23 </div>
24
25 <div class="row mts txtcenter">
26 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
27 <button type="submit">Login</button>
28 <a href="{{ path('fos_user_registration_register') }}" class="button">{% trans %}Register{% endtrans %}</a>
29 <a href="{{ path('fos_user_resetting_request') }}" class="small">Forgot your password?</a>
30 </div>
31 </fieldset>
32 </form>
33{% endblock %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/layout.html.twig
new file mode 100644
index 00000000..ff5b6583
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/layout.html.twig
@@ -0,0 +1,16 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}Welcome on wallabag!{% endblock %}
4
5{% block body_class %}login{% endblock %}
6
7{% block menu %}{% endblock %}
8{% block messages %}{% endblock %}
9
10{% block content %}
11 {% block fos_user_content %}
12 {% endblock fos_user_content %}
13{% endblock %}
14
15{% block footer %}
16{% endblock %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig
new file mode 100644
index 00000000..e7b7318b
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/ChangePassword/changePassword_content.html.twig
@@ -0,0 +1,12 @@
1{% trans_default_domain 'FOSUserBundle' %}
2
3<form action="{{ path('fos_user_change_password') }}" {{ form_enctype(form) }} method="POST" class="fos_user_change_password">
4 <div class="card-content">
5 <div class="row">
6 {{ form_widget(form) }}
7 <div>
8 <input type="submit" value="{{ 'change_password.submit'|trans }}" />
9 </div>
10 </div>
11 </div>
12</form>
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig
new file mode 100644
index 00000000..50937276
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/checkEmail.html.twig
@@ -0,0 +1,11 @@
1{% extends "FOSUserBundle::layout.html.twig" %}
2
3{% trans_default_domain 'FOSUserBundle' %}
4
5{% block fos_user_content %}
6<div class="card-content">
7 <div class="row">
8 <p>{{ 'registration.check_email'|trans({'%email%': user.email}) }}</p>
9 </div>
10</div>
11{% endblock fos_user_content %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig
new file mode 100644
index 00000000..c6d4d3d2
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/confirmed.html.twig
@@ -0,0 +1,17 @@
1{% extends "FOSUserBundle::layout.html.twig" %}
2
3{% trans_default_domain 'FOSUserBundle' %}
4
5{% block fos_user_content %}
6<div class="card-content">
7 <div class="row">
8 <p>{{ 'registration.confirmed'|trans({'%username%': user.username}) }}</p>
9 {% if targetUrl %}
10 <p><a href="{{ targetUrl }}">{{ 'registration.back'|trans }}</a></p>
11 {% endif %}
12 </div>
13 <div class="card-action center">
14 <a href="{{ path('homepage') }}" class="waves-effect waves-light btn"><i class="material-icons left"></i> {% trans %}Go to your account{% endtrans %}</a>
15 </div>
16</div>
17{% endblock fos_user_content %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig
new file mode 100644
index 00000000..865a24ae
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Registration/register_content.html.twig
@@ -0,0 +1,45 @@
1{% trans_default_domain 'FOSUserBundle' %}
2
3<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="fos_user_registration_register">
4 <div class="card-content">
5 <div class="row">
6
7 {{ form_widget(form._token) }}
8
9 {% for flashMessage in app.session.flashbag.get('notice') %}
10 <span class="black-text"><p>{{ flashMessage }}</p></span>
11 {% endfor %}
12
13 <div class="input-field col s12">
14 {{ form_errors(form.email) }}
15 {{ form_label(form.email) }}
16 {{ form_widget(form.email) }}
17 </div>
18
19 <div class="input-field col s12">
20 {{ form_errors(form.username) }}
21 {{ form_label(form.username) }}
22 {{ form_widget(form.username) }}
23 </div>
24
25 <div class="input-field col s12">
26 {{ form_errors(form.plainPassword.first) }}
27 {{ form_label(form.plainPassword.first) }}
28 {{ form_widget(form.plainPassword.first) }}
29 </div>
30
31 <div class="input-field col s12">
32 {{ form_errors(form.plainPassword.second) }}
33 {{ form_label(form.plainPassword.second) }}
34 {{ form_widget(form.plainPassword.second) }}
35 </div>
36 </div>
37 </div>
38 <div class="card-action center">
39 <a href="{{ path('fos_user_security_login') }}" class="waves-effect waves-light grey btn"><i class="material-icons left"></i> {% trans %}Login{% endtrans %}</a>
40 <button class="btn waves-effect waves-light" type="submit" name="send">
41 {{ 'registration.submit'|trans({}, 'FOSUserBundle') }}
42 <i class="mdi-content-send right"></i>
43 </button>
44 </div>
45</form>
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig
new file mode 100644
index 00000000..66cbdc28
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/checkEmail.html.twig
@@ -0,0 +1,11 @@
1{% extends "FOSUserBundle::layout.html.twig" %}
2
3{% trans_default_domain 'FOSUserBundle' %}
4
5{% block fos_user_content %}
6<div class="card-content">
7 <div class="row">
8 {{ 'resetting.check_email'|trans({'%email%': email}) }}
9 </div>
10</div>
11{% endblock fos_user_content %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig
new file mode 100644
index 00000000..0eec4301
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/passwordAlreadyRequested.html.twig
@@ -0,0 +1,11 @@
1{% extends "FOSUserBundle::layout.html.twig" %}
2
3{% trans_default_domain 'FOSUserBundle' %}
4
5{% block fos_user_content %}
6<div class="card-content">
7 <div class="row">
8 {{ 'resetting.password_already_requested'|trans }}
9 </div>
10</div>
11{% endblock fos_user_content %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig
new file mode 100644
index 00000000..e871d7be
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/request_content.html.twig
@@ -0,0 +1,26 @@
1{% trans_default_domain 'FOSUserBundle' %}
2<form action="{{ path('fos_user_resetting_send_email') }}" method="POST" class="fos_user_resetting_request">
3 <div class="card-content">
4 <div class="row">
5 <p>{% trans %}Enter your email address below and we'll send you password reset instructions.{% endtrans %}</p>
6 {% for flashMessage in app.session.flashbag.get('notice') %}
7 <span class="black-text"><p>{{ flashMessage }}</p></span>
8 {% endfor %}
9
10 {% if invalid_username is defined %}
11 <p>{{ 'resetting.request.invalid_username'|trans({'%username%': invalid_username}) }}</p>
12 {% endif %}
13
14 <div class="input-field col s12">
15 <label for="username">{{ 'resetting.request.username'|trans }}</label>
16 <input type="text" id="username" name="username" required="required" />
17 </div>
18 </div>
19 </div>
20 <div class="card-action center">
21 <a href="{{ path('fos_user_security_login') }}" class="waves-effect waves-light grey btn"><i class="material-icons left"></i> {% trans %}Login{% endtrans %}</a>
22 <button class="btn waves-effect waves-light" type="submit" name="send">
23 {{ 'resetting.request.submit'|trans }}
24 </button>
25 </div>
26</form>
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig
new file mode 100644
index 00000000..f7e061dd
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Resetting/reset_content.html.twig
@@ -0,0 +1,15 @@
1{% trans_default_domain 'FOSUserBundle' %}
2
3<form action="{{ path('fos_user_resetting_reset', {'token': token}) }}" {{ form_enctype(form) }} method="POST" class="fos_user_resetting_reset">
4 <div class="card-content">
5 <div class="row">
6 {{ form_widget(form) }}
7 </div>
8 <div class="card-action center">
9 <button class="btn waves-effect waves-light" type="submit" name="send">
10 {{ 'resetting.reset.submit'|trans }}
11 <i class="mdi-content-send right"></i>
12 </button>
13 </div>
14 </div>
15</form>
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig
new file mode 100644
index 00000000..6bf99bf8
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Security/login.html.twig
@@ -0,0 +1,46 @@
1{% extends "FOSUserBundle::layout.html.twig" %}
2
3{% block fos_user_content %}
4<form action="{{ path('fos_user_security_check') }}" method="post" name="loginform">
5 <div class="card-content">
6
7 {% if error %}
8 <span class="black-text">{{ error.message }}</span>
9 {% endif %}
10
11 {% for flashMessage in app.session.flashbag.get('notice') %}
12 <span class="black-text"><p>{{ flashMessage }}</p></span>
13 {% endfor %}
14
15 <div class="row">
16
17 <div class="input-field col s12">
18 <label for="username">{% trans %}Username{% endtrans %}</label>
19 <input type="text" id="username" name="_username" value="{{ last_username }}" />
20 </div>
21
22 <div class="input-field col s12">
23 <label for="password">{% trans %}Password{% endtrans %}</label>
24 <input type="password" id="password" name="_password" />
25 </div>
26
27 <div class="input-field col s12">
28 <input type="checkbox" id="remember_me" name="_remember_me" checked />
29 <label for="remember_me">{% trans %}Keep me logged in{% endtrans %}</label>
30 </div>
31
32 </div>
33 </div>
34 <div class="card-action center">
35 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
36 <a href="{{ path('fos_user_registration_register') }}" class="waves-effect waves-light grey btn"><i class="material-icons left"></i> {% trans %}Register{% endtrans %}</a>
37 <button class="btn waves-effect waves-light" type="submit" name="send">
38 {% trans %}Login{% endtrans %}
39 <i class="mdi-content-send right"></i>
40 </button>
41 </div>
42 <div class="center">
43 <a href="{{ path('fos_user_resetting_request') }}">{% trans %}Forgot your password?{% endtrans %}</a>
44 </div>
45</form>
46{% endblock fos_user_content %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig
new file mode 100644
index 00000000..a69e68c2
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/layout.html.twig
@@ -0,0 +1,23 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}Welcome on wallabag!{% endblock %}
4
5{% block body_class %}login{% endblock %}
6
7{% block menu %}{% endblock %}
8{% block messages %}{% endblock %}
9
10{% block content %}
11<main class="valign-wrapper">
12 <div class="valign row">
13 <div class="card sw">
14 <div class="center"><img src="{{ asset('themes/material/img/logo-other_themes.png') }}" alt="wallabag logo" /></div>
15 {% block fos_user_content %}
16 {% endblock fos_user_content %}
17 </div>
18 </div>
19</main>
20{% endblock %}
21
22{% block footer %}
23{% endblock %}
diff --git a/src/Wallabag/UserBundle/WallabagUserBundle.php b/src/Wallabag/UserBundle/WallabagUserBundle.php
new file mode 100644
index 00000000..d9180b3b
--- /dev/null
+++ b/src/Wallabag/UserBundle/WallabagUserBundle.php
@@ -0,0 +1,13 @@
1<?php
2
3namespace Wallabag\UserBundle;
4
5use Symfony\Component\HttpKernel\Bundle\Bundle;
6
7class WallabagUserBundle extends Bundle
8{
9 public function getParent()
10 {
11 return 'FOSUserBundle';
12 }
13}