aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/UserBundle
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/UserBundle')
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php26
-rw-r--r--src/Wallabag/UserBundle/Form/UserType.php4
-rw-r--r--src/Wallabag/UserBundle/Repository/UserRepository.php14
-rw-r--r--src/Wallabag/UserBundle/Resources/config/services.yml2
-rw-r--r--src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml2
-rw-r--r--src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig8
-rw-r--r--src/Wallabag/UserBundle/Resources/views/Manage/index.html.twig2
-rw-r--r--src/Wallabag/UserBundle/Resources/views/Resetting/check_email.html.twig (renamed from src/Wallabag/UserBundle/Resources/views/Resetting/checkEmail.html.twig)2
-rw-r--r--src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig2
9 files changed, 44 insertions, 18 deletions
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index d98ae76a..3a167de7 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -11,6 +11,7 @@ use JMS\Serializer\Annotation\ExclusionPolicy;
11use JMS\Serializer\Annotation\Expose; 11use JMS\Serializer\Annotation\Expose;
12use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; 12use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
13use Symfony\Component\Security\Core\User\UserInterface; 13use Symfony\Component\Security\Core\User\UserInterface;
14use Wallabag\ApiBundle\Entity\Client;
14use Wallabag\CoreBundle\Entity\Config; 15use Wallabag\CoreBundle\Entity\Config;
15use Wallabag\CoreBundle\Entity\Entry; 16use Wallabag\CoreBundle\Entity\Entry;
16 17
@@ -84,6 +85,11 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
84 */ 85 */
85 private $trusted; 86 private $trusted;
86 87
88 /**
89 * @ORM\OneToMany(targetEntity="Wallabag\ApiBundle\Entity\Client", mappedBy="user", cascade={"remove"})
90 */
91 protected $clients;
92
87 public function __construct() 93 public function __construct()
88 { 94 {
89 parent::__construct(); 95 parent::__construct();
@@ -240,4 +246,24 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
240 246
241 return false; 247 return false;
242 } 248 }
249
250 /**
251 * @param Client $client
252 *
253 * @return User
254 */
255 public function addClient(Client $client)
256 {
257 $this->clients[] = $client;
258
259 return $this;
260 }
261
262 /**
263 * @return ArrayCollection<Entry>
264 */
265 public function getClients()
266 {
267 return $this->clients;
268 }
243} 269}
diff --git a/src/Wallabag/UserBundle/Form/UserType.php b/src/Wallabag/UserBundle/Form/UserType.php
index cfa67793..d8cdbaf9 100644
--- a/src/Wallabag/UserBundle/Form/UserType.php
+++ b/src/Wallabag/UserBundle/Form/UserType.php
@@ -35,10 +35,6 @@ class UserType extends AbstractType
35 'required' => false, 35 'required' => false,
36 'label' => 'user.form.enabled_label', 36 'label' => 'user.form.enabled_label',
37 ]) 37 ])
38 ->add('locked', CheckboxType::class, [
39 'required' => false,
40 'label' => 'user.form.locked_label',
41 ])
42 ->add('twoFactorAuthentication', CheckboxType::class, [ 38 ->add('twoFactorAuthentication', CheckboxType::class, [
43 'required' => false, 39 'required' => false,
44 'label' => 'user.form.twofactor_label', 40 'label' => 'user.form.twofactor_label',
diff --git a/src/Wallabag/UserBundle/Repository/UserRepository.php b/src/Wallabag/UserBundle/Repository/UserRepository.php
index 009c4881..f913f52d 100644
--- a/src/Wallabag/UserBundle/Repository/UserRepository.php
+++ b/src/Wallabag/UserBundle/Repository/UserRepository.php
@@ -38,4 +38,18 @@ class UserRepository extends EntityRepository
38 ->getQuery() 38 ->getQuery()
39 ->getSingleResult(); 39 ->getSingleResult();
40 } 40 }
41
42 /**
43 * Count how many users are enabled.
44 *
45 * @return int
46 */
47 public function getSumEnabledUsers()
48 {
49 return $this->createQueryBuilder('u')
50 ->select('count(u)')
51 ->andWhere('u.enabled = true')
52 ->getQuery()
53 ->getSingleScalarResult();
54 }
41} 55}
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
index a8ee721b..164a25ec 100644
--- a/src/Wallabag/UserBundle/Resources/config/services.yml
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
@@ -22,7 +22,7 @@ services:
22 arguments: 22 arguments:
23 - WallabagUserBundle:User 23 - WallabagUserBundle:User
24 24
25 wallabag_user.create_config: 25 wallabag_user.listener.create_config:
26 class: Wallabag\UserBundle\EventListener\CreateConfigListener 26 class: Wallabag\UserBundle\EventListener\CreateConfigListener
27 arguments: 27 arguments:
28 - "@doctrine.orm.entity_manager" 28 - "@doctrine.orm.entity_manager"
diff --git a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
index 85f2ea9c..ee0a27d5 100644
--- a/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
+++ b/src/Wallabag/UserBundle/Resources/translations/wallabag_user.en.yml
@@ -2,7 +2,7 @@
2auth_code: 2auth_code:
3 on: 'on' 3 on: 'on'
4 mailer: 4 mailer:
5 subject: 'Wallabag authentication Code' 5 subject: 'wallabag authentication code'
6 body: 6 body:
7 hello: "Hi %user%," 7 hello: "Hi %user%,"
8 first_para: "Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection." 8 first_para: "Since you enable two factor authentication on your wallabag account and you just logged in from a new device (computer, phone, etc.), we send you a code to validate your connection."
diff --git a/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig b/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig
index 67843f20..3ffd15f5 100644
--- a/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig
+++ b/src/Wallabag/UserBundle/Resources/views/Manage/edit.html.twig
@@ -47,14 +47,6 @@
47 </div> 47 </div>
48 </div> 48 </div>
49 49
50 <div class="row">
51 <div class="input-field col s12">
52 {{ form_widget(edit_form.locked) }}
53 {{ form_label(edit_form.locked) }}
54 {{ form_errors(edit_form.locked) }}
55 </div>
56 </div>
57
58 {% if twofactor_auth %} 50 {% if twofactor_auth %}
59 <div class="row"> 51 <div class="row">
60 <div class="input-field col s12"> 52 <div class="input-field col s12">
diff --git a/src/Wallabag/UserBundle/Resources/views/Manage/index.html.twig b/src/Wallabag/UserBundle/Resources/views/Manage/index.html.twig
index 996bdb1a..daba29e4 100644
--- a/src/Wallabag/UserBundle/Resources/views/Manage/index.html.twig
+++ b/src/Wallabag/UserBundle/Resources/views/Manage/index.html.twig
@@ -17,7 +17,6 @@
17 <th>{{ 'user.form.username_label'|trans }}</th> 17 <th>{{ 'user.form.username_label'|trans }}</th>
18 <th>{{ 'user.form.email_label'|trans }}</th> 18 <th>{{ 'user.form.email_label'|trans }}</th>
19 <th>{{ 'user.form.last_login_label'|trans }}</th> 19 <th>{{ 'user.form.last_login_label'|trans }}</th>
20 <th>{{ 'user.form.locked_label'|trans }}</th>
21 <th>{{ 'user.list.actions'|trans }}</th> 20 <th>{{ 'user.list.actions'|trans }}</th>
22 </tr> 21 </tr>
23 </thead> 22 </thead>
@@ -27,7 +26,6 @@
27 <td>{{ user.username }}</td> 26 <td>{{ user.username }}</td>
28 <td>{{ user.email }}</td> 27 <td>{{ user.email }}</td>
29 <td>{% if user.lastLogin %}{{ user.lastLogin|date('Y-m-d H:i:s') }}{% endif %}</td> 28 <td>{% if user.lastLogin %}{{ user.lastLogin|date('Y-m-d H:i:s') }}{% endif %}</td>
30 <td>{% if user.locked %}{{ 'user.list.yes'|trans }}{% else %}{{ 'user.list.no'|trans }}{% endif %}</td>
31 <td> 29 <td>
32 <a href="{{ path('user_edit', { 'id': user.id }) }}">{{ 'user.list.edit_action'|trans }}</a> 30 <a href="{{ path('user_edit', { 'id': user.id }) }}">{{ 'user.list.edit_action'|trans }}</a>
33 </td> 31 </td>
diff --git a/src/Wallabag/UserBundle/Resources/views/Resetting/checkEmail.html.twig b/src/Wallabag/UserBundle/Resources/views/Resetting/check_email.html.twig
index 66cbdc28..e9d46dcc 100644
--- a/src/Wallabag/UserBundle/Resources/views/Resetting/checkEmail.html.twig
+++ b/src/Wallabag/UserBundle/Resources/views/Resetting/check_email.html.twig
@@ -5,7 +5,7 @@
5{% block fos_user_content %} 5{% block fos_user_content %}
6<div class="card-content"> 6<div class="card-content">
7 <div class="row"> 7 <div class="row">
8 {{ 'resetting.check_email'|trans({'%email%': email}) }} 8 <p>{{ 'resetting.check_email'|trans({'%tokenLifetime%': tokenLifetime}) }}</p>
9 </div> 9 </div>
10</div> 10</div>
11{% endblock fos_user_content %} 11{% endblock fos_user_content %}
diff --git a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig
index 3731f13b..5d1f22b7 100644
--- a/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig
+++ b/src/Wallabag/UserBundle/Resources/views/TwoFactor/email_auth_code.html.twig
@@ -74,7 +74,7 @@
74 74
75 <table cellpadding="0" cellspacing="0" border="0" align="center" id="card"> 75 <table cellpadding="0" cellspacing="0" border="0" align="center" id="card">
76 <tr> 76 <tr>
77 <td style="padding: 20px;" width="96px" valign="top"><img class="image_fix" src="{{ asset('bundles/wallabagcore/themes/material/img/logo-other_themes.png') }}" alt="logo" title="{{ wallabag_url }}" style="width: 96px; height: 96px;" /></td> 77 <td style="padding: 20px;" width="96px" valign="top"><img class="image_fix" src="{{ absolute_url(asset('bundles/wallabagcore/themes/_global/img/logo-other_themes.png')) }}" alt="logo" title="{{ wallabag_url }}" style="width: 96px; height: 96px;" /></td>
78 <td style="padding: 20px; padding-left: 0;" valign="top" id="cell_desc"> 78 <td style="padding: 20px; padding-left: 0;" valign="top" id="cell_desc">
79 <h1>wallabag</h1> 79 <h1>wallabag</h1>
80 <h5>{{ "auth_code.on"|trans({}, 'wallabag_user') }} {{ wallabag_url }}</h5> 80 <h5>{{ "auth_code.on"|trans({}, 'wallabag_user') }} {{ wallabag_url }}</h5>