aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php2
-rw-r--r--src/Wallabag/CoreBundle/Controller/SiteCredentialController.php174
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php34
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/Configuration.php2
-rw-r--r--src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php1
-rw-r--r--src/Wallabag/CoreBundle/Entity/SiteCredential.php195
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php44
-rw-r--r--src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php42
-rw-r--r--src/Wallabag/CoreBundle/Helper/CryptoProxy.php86
-rw-r--r--src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php47
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml17
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml34
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml26
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/edit.html.twig60
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/index.html.twig42
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/new.html.twig53
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig3
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig20
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/edit.html.twig60
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/index.html.twig42
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/new.html.twig53
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig5
32 files changed, 1256 insertions, 26 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 0f119377..eb725a59 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -313,6 +313,8 @@ class InstallCommand extends ContainerAwareCommand
313 313
314 $this 314 $this
315 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]); 315 ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]);
316
317 return $this;
316 } 318 }
317 319
318 /** 320 /**
diff --git a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
new file mode 100644
index 00000000..98781dab
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
@@ -0,0 +1,174 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Symfony\Component\HttpFoundation\Request;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9use Wallabag\UserBundle\Entity\User;
10use Wallabag\CoreBundle\Entity\SiteCredential;
11
12/**
13 * SiteCredential controller.
14 *
15 * @Route("/site-credentials")
16 */
17class SiteCredentialController extends Controller
18{
19 /**
20 * Lists all User entities.
21 *
22 * @Route("/", name="site_credentials_index")
23 * @Method("GET")
24 */
25 public function indexAction()
26 {
27 $credentials = $this->get('wallabag_core.site_credential_repository')->findByUser($this->getUser());
28
29 return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', [
30 'credentials' => $credentials,
31 ]);
32 }
33
34 /**
35 * Creates a new site credential entity.
36 *
37 * @Route("/new", name="site_credentials_new")
38 * @Method({"GET", "POST"})
39 *
40 * @param Request $request
41 *
42 * @return \Symfony\Component\HttpFoundation\Response
43 */
44 public function newAction(Request $request)
45 {
46 $credential = new SiteCredential($this->getUser());
47
48 $form = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $credential);
49 $form->handleRequest($request);
50
51 if ($form->isSubmitted() && $form->isValid()) {
52 $credential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getUsername()));
53 $credential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getPassword()));
54
55 $em = $this->getDoctrine()->getManager();
56 $em->persist($credential);
57 $em->flush();
58
59 $this->get('session')->getFlashBag()->add(
60 'notice',
61 $this->get('translator')->trans('flashes.site_credential.notice.added', ['%host%' => $credential->getHost()])
62 );
63
64 return $this->redirectToRoute('site_credentials_index');
65 }
66
67 return $this->render('WallabagCoreBundle:SiteCredential:new.html.twig', [
68 'credential' => $credential,
69 'form' => $form->createView(),
70 ]);
71 }
72
73 /**
74 * Displays a form to edit an existing site credential entity.
75 *
76 * @Route("/{id}/edit", name="site_credentials_edit")
77 * @Method({"GET", "POST"})
78 *
79 * @param Request $request
80 * @param SiteCredential $siteCredential
81 *
82 * @return \Symfony\Component\HttpFoundation\Response
83 */
84 public function editAction(Request $request, SiteCredential $siteCredential)
85 {
86 $this->checkUserAction($siteCredential);
87
88 $deleteForm = $this->createDeleteForm($siteCredential);
89 $editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $siteCredential);
90 $editForm->handleRequest($request);
91
92 if ($editForm->isSubmitted() && $editForm->isValid()) {
93 $siteCredential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getUsername()));
94 $siteCredential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getPassword()));
95
96 $em = $this->getDoctrine()->getManager();
97 $em->persist($siteCredential);
98 $em->flush();
99
100 $this->get('session')->getFlashBag()->add(
101 'notice',
102 $this->get('translator')->trans('flashes.site_credential.notice.updated', ['%host%' => $siteCredential->getHost()])
103 );
104
105 return $this->redirectToRoute('site_credentials_index');
106 }
107
108 return $this->render('WallabagCoreBundle:SiteCredential:edit.html.twig', [
109 'credential' => $siteCredential,
110 'edit_form' => $editForm->createView(),
111 'delete_form' => $deleteForm->createView(),
112 ]);
113 }
114
115 /**
116 * Deletes a site credential entity.
117 *
118 * @Route("/{id}", name="site_credentials_delete")
119 * @Method("DELETE")
120 *
121 * @param Request $request
122 * @param SiteCredential $siteCredential
123 *
124 * @return \Symfony\Component\HttpFoundation\RedirectResponse
125 */
126 public function deleteAction(Request $request, SiteCredential $siteCredential)
127 {
128 $this->checkUserAction($siteCredential);
129
130 $form = $this->createDeleteForm($siteCredential);
131 $form->handleRequest($request);
132
133 if ($form->isSubmitted() && $form->isValid()) {
134 $this->get('session')->getFlashBag()->add(
135 'notice',
136 $this->get('translator')->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()])
137 );
138
139 $em = $this->getDoctrine()->getManager();
140 $em->remove($siteCredential);
141 $em->flush();
142 }
143
144 return $this->redirectToRoute('site_credentials_index');
145 }
146
147 /**
148 * Creates a form to delete a site credential entity.
149 *
150 * @param SiteCredential $siteCredential The site credential entity
151 *
152 * @return \Symfony\Component\Form\Form The form
153 */
154 private function createDeleteForm(SiteCredential $siteCredential)
155 {
156 return $this->createFormBuilder()
157 ->setAction($this->generateUrl('site_credentials_delete', ['id' => $siteCredential->getId()]))
158 ->setMethod('DELETE')
159 ->getForm()
160 ;
161 }
162
163 /**
164 * Check if the logged user can manage the given site credential.
165 *
166 * @param SiteCredential $siteCredential The site credential entity
167 */
168 private function checkUserAction(SiteCredential $siteCredential)
169 {
170 if (null === $this->getUser() || $this->getUser()->getId() != $siteCredential->getUser()->getId()) {
171 throw $this->createAccessDeniedException('You can not access this site credential.');
172 }
173 }
174}
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php
new file mode 100644
index 00000000..866f55a4
--- /dev/null
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php
@@ -0,0 +1,34 @@
1<?php
2
3namespace Wallabag\CoreBundle\DataFixtures\ORM;
4
5use Doctrine\Common\DataFixtures\AbstractFixture;
6use Doctrine\Common\DataFixtures\OrderedFixtureInterface;
7use Doctrine\Common\Persistence\ObjectManager;
8use Wallabag\CoreBundle\Entity\SiteCredential;
9
10class LoadSiteCredentialData extends AbstractFixture implements OrderedFixtureInterface
11{
12 /**
13 * {@inheritdoc}
14 */
15 public function load(ObjectManager $manager)
16 {
17 $credential = new SiteCredential($this->getReference('admin-user'));
18 $credential->setHost('example.com');
19 $credential->setUsername('foo');
20 $credential->setPassword('bar');
21
22 $manager->persist($credential);
23
24 $manager->flush();
25 }
26
27 /**
28 * {@inheritdoc}
29 */
30 public function getOrder()
31 {
32 return 50;
33 }
34}
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
index 33df92d3..a9791f6b 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php
@@ -63,6 +63,8 @@ class Configuration implements ConfigurationInterface
63 ->end() 63 ->end()
64 ->end() 64 ->end()
65 ->end() 65 ->end()
66 ->scalarNode('encryption_key_path')
67 ->end()
66 ->end() 68 ->end()
67 ; 69 ;
68 70
diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
index b4d8a386..532ce238 100644
--- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
+++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php
@@ -29,6 +29,7 @@ class WallabagCoreExtension extends Extension
29 $container->setParameter('wallabag_core.fetching_error_message_title', $config['fetching_error_message_title']); 29 $container->setParameter('wallabag_core.fetching_error_message_title', $config['fetching_error_message_title']);
30 $container->setParameter('wallabag_core.api_limit_mass_actions', $config['api_limit_mass_actions']); 30 $container->setParameter('wallabag_core.api_limit_mass_actions', $config['api_limit_mass_actions']);
31 $container->setParameter('wallabag_core.default_internal_settings', $config['default_internal_settings']); 31 $container->setParameter('wallabag_core.default_internal_settings', $config['default_internal_settings']);
32 $container->setParameter('wallabag_core.site_credentials.encryption_key_path', $config['encryption_key_path']);
32 33
33 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); 34 $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
34 $loader->load('services.yml'); 35 $loader->load('services.yml');
diff --git a/src/Wallabag/CoreBundle/Entity/SiteCredential.php b/src/Wallabag/CoreBundle/Entity/SiteCredential.php
new file mode 100644
index 00000000..58075e92
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Entity/SiteCredential.php
@@ -0,0 +1,195 @@
1<?php
2
3namespace Wallabag\CoreBundle\Entity;
4
5use Doctrine\ORM\Mapping as ORM;
6use Symfony\Component\Validator\Constraints as Assert;
7use Wallabag\UserBundle\Entity\User;
8
9/**
10 * SiteCredential.
11 *
12 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\SiteCredentialRepository")
13 * @ORM\Table(name="`site_credential`")
14 * @ORM\HasLifecycleCallbacks()
15 */
16class SiteCredential
17{
18 /**
19 * @var int
20 *
21 * @ORM\Column(name="id", type="integer")
22 * @ORM\Id
23 * @ORM\GeneratedValue(strategy="AUTO")
24 */
25 private $id;
26
27 /**
28 * @var string
29 *
30 * @Assert\NotBlank()
31 * @Assert\Length(max=255)
32 * @ORM\Column(name="host", type="string", length=255)
33 */
34 private $host;
35
36 /**
37 * @var string
38 *
39 * @Assert\NotBlank()
40 * @ORM\Column(name="username", type="text")
41 */
42 private $username;
43
44 /**
45 * @var string
46 *
47 * @Assert\NotBlank()
48 * @ORM\Column(name="password", type="text")
49 */
50 private $password;
51
52 /**
53 * @var \DateTime
54 *
55 * @ORM\Column(name="createdAt", type="datetime")
56 */
57 private $createdAt;
58
59 /**
60 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="site_credentials")
61 */
62 private $user;
63
64 /*
65 * @param User $user
66 */
67 public function __construct(User $user)
68 {
69 $this->user = $user;
70 }
71
72 /**
73 * Get id.
74 *
75 * @return int
76 */
77 public function getId()
78 {
79 return $this->id;
80 }
81
82 /**
83 * Set host.
84 *
85 * @param string $host
86 *
87 * @return SiteCredential
88 */
89 public function setHost($host)
90 {
91 $this->host = $host;
92
93 return $this;
94 }
95
96 /**
97 * Get host.
98 *
99 * @return string
100 */
101 public function getHost()
102 {
103 return $this->host;
104 }
105
106 /**
107 * Set username.
108 *
109 * @param string $username
110 *
111 * @return SiteCredential
112 */
113 public function setUsername($username)
114 {
115 $this->username = $username;
116
117 return $this;
118 }
119
120 /**
121 * Get username.
122 *
123 * @return string
124 */
125 public function getUsername()
126 {
127 return $this->username;
128 }
129
130 /**
131 * Set password.
132 *
133 * @param string $password
134 *
135 * @return SiteCredential
136 */
137 public function setPassword($password)
138 {
139 $this->password = $password;
140
141 return $this;
142 }
143
144 /**
145 * Get password.
146 *
147 * @return string
148 */
149 public function getPassword()
150 {
151 return $this->password;
152 }
153
154 /**
155 * Set createdAt.
156 *
157 * @param \DateTime $createdAt
158 *
159 * @return SiteCredential
160 */
161 public function setCreatedAt($createdAt)
162 {
163 $this->createdAt = $createdAt;
164
165 return $this;
166 }
167
168 /**
169 * Get createdAt.
170 *
171 * @return \DateTime
172 */
173 public function getCreatedAt()
174 {
175 return $this->createdAt;
176 }
177
178 /**
179 * @return User
180 */
181 public function getUser()
182 {
183 return $this->user;
184 }
185
186 /**
187 * @ORM\PrePersist
188 */
189 public function timestamps()
190 {
191 if (is_null($this->createdAt)) {
192 $this->createdAt = new \DateTime();
193 }
194 }
195}
diff --git a/src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php b/src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php
new file mode 100644
index 00000000..fd409ad2
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php
@@ -0,0 +1,44 @@
1<?php
2
3namespace Wallabag\CoreBundle\Form\Type;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\Extension\Core\Type\PasswordType;
7use Symfony\Component\Form\Extension\Core\Type\SubmitType;
8use Symfony\Component\Form\Extension\Core\Type\TextType;
9use Symfony\Component\Form\FormBuilderInterface;
10use Symfony\Component\OptionsResolver\OptionsResolver;
11
12class SiteCredentialType extends AbstractType
13{
14 public function buildForm(FormBuilderInterface $builder, array $options)
15 {
16 $builder
17 ->add('host', TextType::class, [
18 'label' => 'site_credential.form.host_label',
19 ])
20 ->add('username', TextType::class, [
21 'label' => 'site_credential.form.username_label',
22 'data' => '',
23 ])
24 ->add('password', PasswordType::class, [
25 'label' => 'site_credential.form.password_label',
26 ])
27 ->add('save', SubmitType::class, [
28 'label' => 'config.form.save',
29 ])
30 ;
31 }
32
33 public function configureOptions(OptionsResolver $resolver)
34 {
35 $resolver->setDefaults([
36 'data_class' => 'Wallabag\CoreBundle\Entity\SiteCredential',
37 ]);
38 }
39
40 public function getBlockPrefix()
41 {
42 return 'site_credential';
43 }
44}
diff --git a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
index 1c56fa9f..a79e6ebe 100644
--- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
+++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php
@@ -6,6 +6,8 @@ use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig;
6use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; 6use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder;
7use Graby\SiteConfig\ConfigBuilder; 7use Graby\SiteConfig\ConfigBuilder;
8use Psr\Log\LoggerInterface; 8use Psr\Log\LoggerInterface;
9use Wallabag\CoreBundle\Repository\SiteCredentialRepository;
10use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage;
9 11
10class GrabySiteConfigBuilder implements SiteConfigBuilder 12class GrabySiteConfigBuilder implements SiteConfigBuilder
11{ 13{
@@ -13,27 +15,39 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
13 * @var ConfigBuilder 15 * @var ConfigBuilder
14 */ 16 */
15 private $grabyConfigBuilder; 17 private $grabyConfigBuilder;
18
16 /** 19 /**
17 * @var array 20 * @var SiteCredentialRepository
18 */ 21 */
19 private $credentials; 22 private $credentialRepository;
23
20 /** 24 /**
21 * @var LoggerInterface 25 * @var LoggerInterface
22 */ 26 */
23 private $logger; 27 private $logger;
24 28
25 /** 29 /**
30 * @var Wallabag\UserBundle\Entity\User|null
31 */
32 private $currentUser;
33
34 /**
26 * GrabySiteConfigBuilder constructor. 35 * GrabySiteConfigBuilder constructor.
27 * 36 *
28 * @param ConfigBuilder $grabyConfigBuilder 37 * @param ConfigBuilder $grabyConfigBuilder
29 * @param array $credentials 38 * @param TokenStorage $token
30 * @param LoggerInterface $logger 39 * @param SiteCredentialRepository $credentialRepository
40 * @param LoggerInterface $logger
31 */ 41 */
32 public function __construct(ConfigBuilder $grabyConfigBuilder, array $credentials, LoggerInterface $logger) 42 public function __construct(ConfigBuilder $grabyConfigBuilder, TokenStorage $token, SiteCredentialRepository $credentialRepository, LoggerInterface $logger)
33 { 43 {
34 $this->grabyConfigBuilder = $grabyConfigBuilder; 44 $this->grabyConfigBuilder = $grabyConfigBuilder;
35 $this->credentials = $credentials; 45 $this->credentialRepository = $credentialRepository;
36 $this->logger = $logger; 46 $this->logger = $logger;
47
48 if ($token->getToken()) {
49 $this->currentUser = $token->getToken()->getUser();
50 }
37 } 51 }
38 52
39 /** 53 /**
@@ -47,7 +61,12 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
47 $host = substr($host, 4); 61 $host = substr($host, 4);
48 } 62 }
49 63
50 if (empty($this->credentials[$host])) { 64 $credentials = null;
65 if ($this->currentUser) {
66 $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId());
67 }
68
69 if (null === $credentials) {
51 $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); 70 $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]);
52 71
53 return false; 72 return false;
@@ -62,13 +81,14 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder
62 'passwordField' => $config->login_password_field ?: null, 81 'passwordField' => $config->login_password_field ?: null,
63 'extraFields' => $this->processExtraFields($config->login_extra_fields), 82 'extraFields' => $this->processExtraFields($config->login_extra_fields),
64 'notLoggedInXpath' => $config->not_logged_in_xpath ?: null, 83 'notLoggedInXpath' => $config->not_logged_in_xpath ?: null,
65 'username' => $this->credentials[$host]['username'], 84 'username' => $credentials['username'],
66 'password' => $this->credentials[$host]['password'], 85 'password' => $credentials['password'],
67 ]; 86 ];
68 87
69 $config = new SiteConfig($parameters); 88 $config = new SiteConfig($parameters);
70 89
71 // do not leak password in log 90 // do not leak usernames and passwords in log
91 $parameters['username'] = '**masked**';
72 $parameters['password'] = '**masked**'; 92 $parameters['password'] = '**masked**';
73 93
74 $this->logger->debug('Auth: add parameters.', ['host' => $host, 'parameters' => $parameters]); 94 $this->logger->debug('Auth: add parameters.', ['host' => $host, 'parameters' => $parameters]);
diff --git a/src/Wallabag/CoreBundle/Helper/CryptoProxy.php b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php
new file mode 100644
index 00000000..e8b19cb9
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php
@@ -0,0 +1,86 @@
1<?php
2
3namespace Wallabag\CoreBundle\Helper;
4
5use Psr\Log\LoggerInterface;
6use Defuse\Crypto\Key;
7use Defuse\Crypto\Crypto;
8use Defuse\Crypto\Exception\WrongKeyOrModifiedCiphertextException;
9
10/**
11 * This is a proxy to crypt and decrypt password used by SiteCredential entity.
12 * BTW, It might be re-use for sth else.
13 */
14class CryptoProxy
15{
16 private $logger;
17 private $encryptionKey;
18
19 public function __construct($encryptionKeyPath, LoggerInterface $logger)
20 {
21 $this->logger = $logger;
22
23 if (!file_exists($encryptionKeyPath)) {
24 $key = Key::createNewRandomKey();
25
26 file_put_contents($encryptionKeyPath, $key->saveToAsciiSafeString());
27 chmod($encryptionKeyPath, 0600);
28 }
29
30 $this->encryptionKey = file_get_contents($encryptionKeyPath);
31 }
32
33 /**
34 * Ensure the given value will be crypted.
35 *
36 * @param string $secretValue Secret valye to crypt
37 *
38 * @return string
39 */
40 public function crypt($secretValue)
41 {
42 $this->logger->debug('Crypto: crypting value: '.$this->mask($secretValue));
43
44 return Crypto::encrypt($secretValue, $this->loadKey());
45 }
46
47 /**
48 * Ensure the given crypted value will be decrypted.
49 *
50 * @param string $cryptedValue The value to be decrypted
51 *
52 * @return string
53 */
54 public function decrypt($cryptedValue)
55 {
56 $this->logger->debug('Crypto: decrypting value: '.$this->mask($cryptedValue));
57
58 try {
59 return Crypto::decrypt($cryptedValue, $this->loadKey());
60 } catch (WrongKeyOrModifiedCiphertextException $e) {
61 throw new \RuntimeException('Decrypt fail: '.$e->getMessage());
62 }
63 }
64
65 /**
66 * Load the private key.
67 *
68 * @return Key
69 */
70 private function loadKey()
71 {
72 return Key::loadFromAsciiSafeString($this->encryptionKey);
73 }
74
75 /**
76 * Keep first and last character and put some stars in between.
77 *
78 * @param string $value Value to mask
79 *
80 * @return string
81 */
82 private function mask($value)
83 {
84 return strlen($value) > 0 ? $value[0].'*****'.$value[strlen($value) - 1] : 'Empty value';
85 }
86}
diff --git a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
new file mode 100644
index 00000000..36906761
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
@@ -0,0 +1,47 @@
1<?php
2
3namespace Wallabag\CoreBundle\Repository;
4
5use Wallabag\CoreBundle\Helper\CryptoProxy;
6
7/**
8 * SiteCredentialRepository.
9 */
10class SiteCredentialRepository extends \Doctrine\ORM\EntityRepository
11{
12 private $cryptoProxy;
13
14 public function setCrypto(CryptoProxy $cryptoProxy)
15 {
16 $this->cryptoProxy = $cryptoProxy;
17 }
18
19 /**
20 * Retrieve one username/password for the given host and userId.
21 *
22 * @param string $host
23 * @param int $userId
24 *
25 * @return null|array
26 */
27 public function findOneByHostAndUser($host, $userId)
28 {
29 $res = $this->createQueryBuilder('s')
30 ->select('s.username', 's.password')
31 ->where('s.host = :hostname')->setParameter('hostname', $host)
32 ->andWhere('s.user = :userId')->setParameter('userId', $userId)
33 ->setMaxResults(1)
34 ->getQuery()
35 ->getOneOrNullResult();
36
37 if (null === $res) {
38 return;
39 }
40
41 // decrypt user & password before returning them
42 $res['username'] = $this->cryptoProxy->decrypt($res['username']);
43 $res['password'] = $this->cryptoProxy->decrypt($res['password']);
44
45 return $res;
46 }
47}
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 4be79547..e09b0f18 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -63,7 +63,8 @@ services:
63 class: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder 63 class: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder
64 arguments: 64 arguments:
65 - "@wallabag_core.graby.config_builder" 65 - "@wallabag_core.graby.config_builder"
66 - "%sites_credentials%" 66 - "@security.token_storage"
67 - "@wallabag_core.site_credential_repository"
67 - '@logger' 68 - '@logger'
68 tags: 69 tags:
69 - { name: monolog.logger, channel: graby } 70 - { name: monolog.logger, channel: graby }
@@ -120,6 +121,14 @@ services:
120 arguments: 121 arguments:
121 - WallabagCoreBundle:Tag 122 - WallabagCoreBundle:Tag
122 123
124 wallabag_core.site_credential_repository:
125 class: Wallabag\CoreBundle\Repository\SiteCredentialRepository
126 factory: [ "@doctrine.orm.default_entity_manager", getRepository ]
127 arguments:
128 - WallabagCoreBundle:SiteCredential
129 calls:
130 - [ setCrypto, [ "@wallabag_core.helper.crypto_proxy" ] ]
131
123 wallabag_core.helper.entries_export: 132 wallabag_core.helper.entries_export:
124 class: Wallabag\CoreBundle\Helper\EntriesExport 133 class: Wallabag\CoreBundle\Helper\EntriesExport
125 arguments: 134 arguments:
@@ -201,3 +210,9 @@ services:
201 210
202 wallabag_core.entry.download_images.client: 211 wallabag_core.entry.download_images.client:
203 class: GuzzleHttp\Client 212 class: GuzzleHttp\Client
213
214 wallabag_core.helper.crypto_proxy:
215 class: Wallabag\CoreBundle\Helper\CryptoProxy
216 arguments:
217 - "%wallabag_core.site_credentials.encryption_key_path%"
218 - "@logger"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 02dd04f2..a91a0ce4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -32,6 +32,7 @@ menu:
32 # save_link: 'Save a link' 32 # save_link: 'Save a link'
33 back_to_unread: 'Tilbage til de ulæste artikler' 33 back_to_unread: 'Tilbage til de ulæste artikler'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Tilføj ny artikel' 37 add_new_entry: 'Tilføj ny artikel'
37 search: 'Søg' 38 search: 'Søg'
@@ -520,6 +521,26 @@ user:
520 search: 521 search:
521 # placeholder: Filter by username or email 522 # placeholder: Filter by username or email
522 523
524site_credential:
525 # page_title: Site credentials management
526 # new_site_credential: Create a credential
527 # edit_site_credential: Edit an existing credential
528 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
529 # list:
530 # actions: Actions
531 # edit_action: Edit
532 # yes: Yes
533 # no: No
534 # create_new_one: Create a new credential
535 # form:
536 # username_label: 'Username'
537 # host_label: 'Host'
538 # password_label: 'Password'
539 # save: Save
540 # delete: Delete
541 # delete_confirm: Are you sure?
542 # back_to_list: Back to list
543
523error: 544error:
524 # page_title: An error occurred 545 # page_title: An error occurred
525 546
@@ -572,3 +593,8 @@ flashes:
572 # added: 'User "%username%" added' 593 # added: 'User "%username%" added'
573 # updated: 'User "%username%" updated' 594 # updated: 'User "%username%" updated'
574 # deleted: 'User "%username%" deleted' 595 # deleted: 'User "%username%" deleted'
596 site_credential:
597 notice:
598 # added: 'Site credential for "%host%" added'
599 # updated: 'Site credential for "%host%" updated'
600 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index f6ccdae0..e77cdca3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Link speichern' 32 save_link: 'Link speichern'
33 back_to_unread: 'Zurück zu ungelesenen Artikeln' 33 back_to_unread: 'Zurück zu ungelesenen Artikeln'
34 users_management: 'Benutzerverwaltung' 34 users_management: 'Benutzerverwaltung'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Neuen Artikel hinzufügen' 37 add_new_entry: 'Neuen Artikel hinzufügen'
37 search: 'Suche' 38 search: 'Suche'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 placeholder: Filtere nach Benutzer oder E-Mail-Adresse 523 placeholder: Filtere nach Benutzer oder E-Mail-Adresse
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 list:
531 actions: Aktionen
532 edit_action: Bearbeiten
533 yes: Ja
534 no: Nein
535 # create_new_one: Create a new credential
536 form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 save: Speichern
541 delete: Löschen
542 delete_confirm: Bist du sicher?
543 back_to_list: Zurück zur Liste
544
524error: 545error:
525 page_title: Ein Fehler ist aufgetreten 546 page_title: Ein Fehler ist aufgetreten
526 547
@@ -573,3 +594,8 @@ flashes:
573 added: 'Benutzer "%username%" hinzugefügt' 594 added: 'Benutzer "%username%" hinzugefügt'
574 updated: 'Benutzer "%username%" aktualisiert' 595 updated: 'Benutzer "%username%" aktualisiert'
575 deleted: 'Benutzer "%username%" gelöscht' 596 deleted: 'Benutzer "%username%" gelöscht'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 902c3046..50edab3a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Save a link' 32 save_link: 'Save a link'
33 back_to_unread: 'Back to unread articles' 33 back_to_unread: 'Back to unread articles'
34 users_management: 'Users management' 34 users_management: 'Users management'
35 site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Add a new entry' 37 add_new_entry: 'Add a new entry'
37 search: 'Search' 38 search: 'Search'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 placeholder: Filter by username or email 523 placeholder: Filter by username or email
523 524
525site_credential:
526 page_title: Site credentials management
527 new_site_credential: Create a credential
528 edit_site_credential: Edit an existing credential
529 description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 list:
531 actions: Actions
532 edit_action: Edit
533 yes: Yes
534 no: No
535 create_new_one: Create a new credential
536 form:
537 username_label: 'Username'
538 host_label: 'Host'
539 password_label: 'Password'
540 save: Save
541 delete: Delete
542 delete_confirm: Are you sure?
543 back_to_list: Back to list
544
524error: 545error:
525 page_title: An error occurred 546 page_title: An error occurred
526 547
@@ -573,3 +594,8 @@ flashes:
573 added: 'User "%username%" added' 594 added: 'User "%username%" added'
574 updated: 'User "%username%" updated' 595 updated: 'User "%username%" updated'
575 deleted: 'User "%username%" deleted' 596 deleted: 'User "%username%" deleted'
597 site_credential:
598 notice:
599 added: 'Site credential for "%host%" added'
600 updated: 'Site credential for "%host%" updated'
601 deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index afd6a7b1..6fbf00eb 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Guardar un enlace' 32 save_link: 'Guardar un enlace'
33 back_to_unread: 'Volver a los artículos sin leer' 33 back_to_unread: 'Volver a los artículos sin leer'
34 users_management: 'Configuración de usuarios' 34 users_management: 'Configuración de usuarios'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Añadir un nuevo artículo' 37 add_new_entry: 'Añadir un nuevo artículo'
37 search: 'Buscar' 38 search: 'Buscar'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 # placeholder: Filter by username or email 523 # placeholder: Filter by username or email
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 # list:
531 # actions: Actions
532 # edit_action: Edit
533 # yes: Yes
534 # no: No
535 # create_new_one: Create a new credential
536 # form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 # save: Save
541 # delete: Delete
542 # delete_confirm: Are you sure?
543 # back_to_list: Back to list
544
524error: 545error:
525 page_title: Ha ocurrido un error 546 page_title: Ha ocurrido un error
526 547
@@ -573,3 +594,8 @@ flashes:
573 added: 'Añadido el usuario "%username%"' 594 added: 'Añadido el usuario "%username%"'
574 updated: 'Actualizado el usuario "%username%"' 595 updated: 'Actualizado el usuario "%username%"'
575 deleted: 'Eliminado el usuario "%username%"' 596 deleted: 'Eliminado el usuario "%username%"'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index 545514b3..ad7d6cd9 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'ذخیرهٔ یک پیوند' 32 save_link: 'ذخیرهٔ یک پیوند'
33 back_to_unread: 'بازگشت به خوانده‌نشده‌ها' 33 back_to_unread: 'بازگشت به خوانده‌نشده‌ها'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'افزودن مقالهٔ تازه' 37 add_new_entry: 'افزودن مقالهٔ تازه'
37 search: 'جستجو' 38 search: 'جستجو'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 # placeholder: Filter by username or email 523 # placeholder: Filter by username or email
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 # list:
531 # actions: Actions
532 # edit_action: Edit
533 # yes: Yes
534 # no: No
535 # create_new_one: Create a new credential
536 # form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 # save: Save
541 # delete: Delete
542 # delete_confirm: Are you sure?
543 # back_to_list: Back to list
544
524error: 545error:
525 # page_title: An error occurred 546 # page_title: An error occurred
526 547
@@ -573,3 +594,8 @@ flashes:
573 # added: 'User "%username%" added' 594 # added: 'User "%username%" added'
574 # updated: 'User "%username%" updated' 595 # updated: 'User "%username%" updated'
575 # deleted: 'User "%username%" deleted' 596 # deleted: 'User "%username%" deleted'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index e9e79c67..c4b029c3 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: "Sauvegarder un nouvel article" 32 save_link: "Sauvegarder un nouvel article"
33 back_to_unread: "Retour aux articles non lus" 33 back_to_unread: "Retour aux articles non lus"
34 users_management: "Gestion des utilisateurs" 34 users_management: "Gestion des utilisateurs"
35 site_credentials: 'Accès aux sites'
35 top: 36 top:
36 add_new_entry: "Sauvegarder un nouvel article" 37 add_new_entry: "Sauvegarder un nouvel article"
37 search: "Rechercher" 38 search: "Rechercher"
@@ -516,11 +517,31 @@ user:
516 twofactor_label: "Double authentification" 517 twofactor_label: "Double authentification"
517 save: "Sauvegarder" 518 save: "Sauvegarder"
518 delete: "Supprimer" 519 delete: "Supprimer"
519 delete_confirm: "Voulez-vous vraiment ?" 520 delete_confirm: "Êtes-vous r ?"
520 back_to_list: "Revenir à la liste" 521 back_to_list: "Revenir à la liste"
521 search: 522 search:
522 placeholder: "Filtrer par nom d’utilisateur ou email" 523 placeholder: "Filtrer par nom d’utilisateur ou email"
523 524
525site_credential:
526 page_title: Gestion des accès aux sites
527 new_site_credential: Créer un accès à un site
528 edit_site_credential: Éditer l'accès d'un site
529 description: "Ici vous pouvez gérer les accès aux différents sites. Ces accès permettent de récupérer des contenus sur des sites qui requièrent une authentification ou un paywall"
530 list:
531 actions: Actions
532 edit_action: Éditer
533 yes: Oui
534 no: Non
535 create_new_one: Créer un nouvel accès à un site
536 form:
537 username_label: 'Identifiant'
538 host_label: 'Domaine'
539 password_label: 'Mot de passe'
540 save: "Sauvegarder"
541 delete: "Supprimer"
542 delete_confirm: "Êtes-vous sûr ?"
543 back_to_list: "Revenir à la liste"
544
524error: 545error:
525 page_title: "Une erreur est survenue" 546 page_title: "Une erreur est survenue"
526 547
@@ -570,6 +591,11 @@ flashes:
570 client_deleted: "Client %name% supprimé" 591 client_deleted: "Client %name% supprimé"
571 user: 592 user:
572 notice: 593 notice:
573 added: "Utilisateur \"%username%\" ajouté" 594 added: 'Utilisateur "%username%" ajouté'
574 updated: "Utilisateur \"%username%\" mis à jour" 595 updated: 'Utilisateur "%username%" mis à jour'
575 deleted: "Utilisateur \"%username%\" supprimé" 596 deleted: 'Utilisateur "%username%" supprimé'
597 site_credential:
598 notice:
599 added: 'Accès au site "%host%" ajouté'
600 updated: 'Accès au site "%host%" mis à jour'
601 deleted: 'Accès au site "%host%" supprimé'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 0597d3e3..4bd04aad 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Salva collegamento' 32 save_link: 'Salva collegamento'
33 back_to_unread: 'Torna ai contenuti non letti' 33 back_to_unread: 'Torna ai contenuti non letti'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Aggiungi un nuovo contenuto' 37 add_new_entry: 'Aggiungi un nuovo contenuto'
37 search: 'Cerca' 38 search: 'Cerca'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 # placeholder: Filter by username or email 523 # placeholder: Filter by username or email
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 # list:
531 # actions: Actions
532 # edit_action: Edit
533 # yes: Yes
534 # no: No
535 # create_new_one: Create a new credential
536 # form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 # save: Save
541 # delete: Delete
542 # delete_confirm: Are you sure?
543 # back_to_list: Back to list
544
524error: 545error:
525 # page_title: An error occurred 546 # page_title: An error occurred
526 547
@@ -573,3 +594,8 @@ flashes:
573 # added: 'User "%username%" added' 594 # added: 'User "%username%" added'
574 # updated: 'User "%username%" updated' 595 # updated: 'User "%username%" updated'
575 # deleted: 'User "%username%" deleted' 596 # deleted: 'User "%username%" deleted'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index c172a0f6..a6dd4dcd 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Enregistrar un novèl article' 32 save_link: 'Enregistrar un novèl article'
33 back_to_unread: 'Tornar als articles pas legits' 33 back_to_unread: 'Tornar als articles pas legits'
34 users_management: 'Gestion dels utilizaires' 34 users_management: 'Gestion dels utilizaires'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Enregistrar un novèl article' 37 add_new_entry: 'Enregistrar un novèl article'
37 search: 'Cercar' 38 search: 'Cercar'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 placeholder: "Filtrar per nom d'utilizaire o corrièl" 523 placeholder: "Filtrar per nom d'utilizaire o corrièl"
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 list:
531 actions: 'Accions'
532 edit_action: 'Modificar'
533 yes: 'Òc'
534 no: 'Non'
535 # create_new_one: Create a new credential
536 form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 save: 'Enregistrar'
541 delete: 'Suprimir'
542 delete_confirm: 'Sètz segur ?'
543 back_to_list: 'Tornar a la lista'
544
524error: 545error:
525 page_title: Una error s'es produsida 546 page_title: Una error s'es produsida
526 547
@@ -573,3 +594,8 @@ flashes:
573 added: 'Utilizaire "%username%" ajustat' 594 added: 'Utilizaire "%username%" ajustat'
574 updated: 'Utilizaire "%username%" mes a jorn' 595 updated: 'Utilizaire "%username%" mes a jorn'
575 deleted: 'Utilizaire "%username%" suprimit' 596 deleted: 'Utilizaire "%username%" suprimit'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index 82d16767..7312abd7 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Zapisz link' 32 save_link: 'Zapisz link'
33 back_to_unread: 'Powrót do nieprzeczytanych artykułów' 33 back_to_unread: 'Powrót do nieprzeczytanych artykułów'
34 users_management: 'Zarządzanie użytkownikami' 34 users_management: 'Zarządzanie użytkownikami'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Dodaj nowy wpis' 37 add_new_entry: 'Dodaj nowy wpis'
37 search: 'Szukaj' 38 search: 'Szukaj'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 placeholder: Filtruj po nazwie użytkownika lub adresie e-mail 523 placeholder: Filtruj po nazwie użytkownika lub adresie e-mail
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 list:
531 actions: Akcje
532 edit_action: Edytuj
533 yes: Tak
534 no: Nie
535 # create_new_one: Create a new credential
536 form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 save: Zapisz
541 delete: Usuń
542 delete_confirm: Jesteś pewien?
543 back_to_list: Powrót do listy
544
524error: 545error:
525 page_title: Wystąpił błąd 546 page_title: Wystąpił błąd
526 547
@@ -573,3 +594,8 @@ flashes:
573 added: 'Użytkownik "%username%" dodany' 594 added: 'Użytkownik "%username%" dodany'
574 updated: 'Użytkownik "%username%" zaktualizowany' 595 updated: 'Użytkownik "%username%" zaktualizowany'
575 deleted: 'Użytkownik "%username%" usunięty' 596 deleted: 'Użytkownik "%username%" usunięty'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index b75567d6..18090352 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -32,6 +32,7 @@ menu:
32 save_link: 'Salvar um link' 32 save_link: 'Salvar um link'
33 back_to_unread: 'Voltar para os artigos não lidos' 33 back_to_unread: 'Voltar para os artigos não lidos'
34 users_management: 'Gestão de Usuários' 34 users_management: 'Gestão de Usuários'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Adicionar uma nova entrada' 37 add_new_entry: 'Adicionar uma nova entrada'
37 search: 'Pesquisa' 38 search: 'Pesquisa'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 # placeholder: Filter by username or email 523 # placeholder: Filter by username or email
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 list:
531 actions: 'Ações'
532 edit_action: 'Editar'
533 yes: 'Sim'
534 no: 'Não'
535 # create_new_one: Create a new credential
536 form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 save: 'Salvar'
541 delete: 'Apagar'
542 delete_confirm: 'Tem certeza?'
543 back_to_list: 'Voltar para a lista'
544
524error: 545error:
525 # page_title: An error occurred 546 # page_title: An error occurred
526 547
@@ -573,3 +594,8 @@ flashes:
573 added: 'Usuário "%username%" adicionado' 594 added: 'Usuário "%username%" adicionado'
574 updated: 'Usuário "%username%" atualizado' 595 updated: 'Usuário "%username%" atualizado'
575 deleted: 'Usuário "%username%" removido' 596 deleted: 'Usuário "%username%" removido'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 95df573d..f8866fdc 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -32,6 +32,7 @@ menu:
32 # save_link: 'Save a link' 32 # save_link: 'Save a link'
33 back_to_unread: 'Înapoi la articolele necitite' 33 back_to_unread: 'Înapoi la articolele necitite'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Introdu un nou articol' 37 add_new_entry: 'Introdu un nou articol'
37 search: 'Căutare' 38 search: 'Căutare'
@@ -521,6 +522,26 @@ user:
521 search: 522 search:
522 # placeholder: Filter by username or email 523 # placeholder: Filter by username or email
523 524
525site_credential:
526 # page_title: Site credentials management
527 # new_site_credential: Create a credential
528 # edit_site_credential: Edit an existing credential
529 # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
530 # list:
531 # actions: Actions
532 # edit_action: Edit
533 # yes: Yes
534 # no: No
535 # create_new_one: Create a new credential
536 # form:
537 # username_label: 'Username'
538 # host_label: 'Host'
539 # password_label: 'Password'
540 # save: Save
541 # delete: Delete
542 # delete_confirm: Are you sure?
543 # back_to_list: Back to list
544
524error: 545error:
525 # page_title: An error occurred 546 # page_title: An error occurred
526 547
@@ -573,3 +594,8 @@ flashes:
573 # added: 'User "%username%" added' 594 # added: 'User "%username%" added'
574 # updated: 'User "%username%" updated' 595 # updated: 'User "%username%" updated'
575 # deleted: 'User "%username%" deleted' 596 # deleted: 'User "%username%" deleted'
597 site_credential:
598 notice:
599 # added: 'Site credential for "%host%" added'
600 # updated: 'Site credential for "%host%" updated'
601 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 61e1a1ea..4d01e7f7 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -32,6 +32,7 @@ menu:
32 # save_link: 'Save a link' 32 # save_link: 'Save a link'
33 back_to_unread: 'Okunmayan makalelere geri dön' 33 back_to_unread: 'Okunmayan makalelere geri dön'
34 # users_management: 'Users management' 34 # users_management: 'Users management'
35 # site_credentials: 'Site credentials'
35 top: 36 top:
36 add_new_entry: 'Yeni bir makale ekle' 37 add_new_entry: 'Yeni bir makale ekle'
37 search: 'Ara' 38 search: 'Ara'
@@ -571,3 +572,8 @@ flashes:
571 # added: 'User "%username%" added' 572 # added: 'User "%username%" added'
572 # updated: 'User "%username%" updated' 573 # updated: 'User "%username%" updated'
573 # deleted: 'User "%username%" deleted' 574 # deleted: 'User "%username%" deleted'
575 site_credential:
576 notice:
577 # added: 'Site credential for "%host%" added'
578 # updated: 'Site credential for "%host%" updated'
579 # deleted: 'Site credential for "%host%" deleted'
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/edit.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/edit.html.twig
new file mode 100644
index 00000000..882be430
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/edit.html.twig
@@ -0,0 +1,60 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'site_credential.edit_site_credential'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(edit_form) }}
16 {{ form_errors(edit_form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(edit_form.host) }}
21 {{ form_errors(edit_form.host) }}
22 {{ form_widget(edit_form.host) }}
23 </div>
24 </div>
25
26 <div class="row">
27 <div class="input-field col s12">
28 {{ form_label(edit_form.username) }}
29 {{ form_errors(edit_form.username) }}
30 {{ form_widget(edit_form.username) }}
31 </div>
32 </div>
33
34 <div class="row">
35 <div class="input-field col s12">
36 {{ form_label(edit_form.password) }}
37 {{ form_errors(edit_form.password) }}
38 {{ form_widget(edit_form.password) }}
39 </div>
40 </div>
41
42 <br/>
43
44 {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
45 {{ form_widget(edit_form._token) }}
46 </form>
47 <p>
48 {{ form_start(delete_form) }}
49 <button onclick="return confirm('{{ 'site_credential.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'site_credential.form.delete'|trans }}</button>
50 {{ form_end(delete_form) }}
51 </p>
52 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credentials_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
53 </div>
54 </div>
55 </div>
56 </div>
57 </div>
58 </div>
59
60{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/index.html.twig
new file mode 100644
index 00000000..324854ad
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/index.html.twig
@@ -0,0 +1,42 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <p class="help">{{ 'site_credential.description'|trans|raw }}</p>
13
14 <table class="bordered">
15 <thead>
16 <tr>
17 <th>{{ 'site_credential.form.host_label'|trans }}</th>
18 <th>{{ 'site_credential.list.actions'|trans }}</th>
19 </tr>
20 </thead>
21 <tbody>
22 {% for credential in credentials %}
23 <tr>
24 <td>{{ credential.host }}</td>
25 <td>
26 <a href="{{ path('site_credentials_edit', { 'id': credential.id }) }}">{{ 'site_credential.list.edit_action'|trans }}</a>
27 </td>
28 </tr>
29 {% endfor %}
30 </tbody>
31 </table>
32 <br />
33 <p>
34 <a href="{{ path('site_credentials_new') }}" class="waves-effect waves-light btn">{{ 'site_credential.list.create_new_one'|trans }}</a>
35 </p>
36 </div>
37 </div>
38 </div>
39 </div>
40 </div>
41
42{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/new.html.twig
new file mode 100644
index 00000000..3c008cde
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/new.html.twig
@@ -0,0 +1,53 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'site_credential.new_site_credential'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(form) }}
16 {{ form_errors(form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(form.host) }}
21 {{ form_errors(form.host) }}
22 {{ form_widget(form.host) }}
23 </div>
24 </div>
25
26 <div class="row">
27 <div class="input-field col s12">
28 {{ form_label(form.username) }}
29 {{ form_errors(form.username) }}
30 {{ form_widget(form.username) }}
31 </div>
32 </div>
33
34 <div class="row">
35 <div class="input-field col s12">
36 {{ form_label(form.password) }}
37 {{ form_errors(form.password) }}
38 {{ form_widget(form.password) }}
39 </div>
40 </div>
41
42 {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
43 {{ form_rest(form) }}
44 </form>
45 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credentials_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
46 </div>
47 </div>
48 </div>
49 </div>
50 </div>
51 </div>
52
53{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
index 42aeace9..17fa13bb 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/layout.html.twig
@@ -38,6 +38,9 @@
38 {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }} 38 {{ render(controller("WallabagCoreBundle:Entry:searchForm", {'currentRoute': app.request.attributes.get('_route')})) }}
39 </div> 39 </div>
40 </li> 40 </li>
41 {% if craue_setting('restricted_access') %}
42 <li class="menu site_credentials"><a href="{{ path('site_credentials_index') }}">{{ 'menu.left.site_credentials'|trans }}</a></li>
43 {% endif %}
41 <li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li> 44 <li class="menu config"><a href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a></li>
42 {% if is_granted('ROLE_SUPER_ADMIN') %} 45 {% if is_granted('ROLE_SUPER_ADMIN') %}
43 <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li> 46 <li class="menu users"><a href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a></li>
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 9b0816eb..1e10bf38 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
@@ -66,13 +66,13 @@
66 </div> 66 </div>
67 </div> 67 </div>
68 68
69 <div class="row"> 69 <div class="row">
70 <div class="input-field col s12"> 70 <div class="input-field col s12">
71 {{ form_errors(form.config.action_mark_as_read) }} 71 {{ form_label(form.config.action_mark_as_read) }}
72 {{ form_widget(form.config.action_mark_as_read) }} 72 {{ form_errors(form.config.action_mark_as_read) }}
73 {{ form_label(form.config.action_mark_as_read) }} 73 {{ form_widget(form.config.action_mark_as_read) }}
74 </div>
74 </div> 75 </div>
75 </div>
76 76
77 <div class="row"> 77 <div class="row">
78 <div class="input-field col s11"> 78 <div class="input-field col s11">
@@ -254,11 +254,11 @@
254 {{ form_start(form.pwd) }} 254 {{ form_start(form.pwd) }}
255 {{ form_errors(form.pwd) }} 255 {{ form_errors(form.pwd) }}
256 256
257 <div class="row"> 257 <div class="row">
258 <div class="input-field col s12"> 258 <div class="input-field col s12">
259 {{ 'config.form_password.description'|trans }} 259 {{ 'config.form_password.description'|trans }}
260 </div>
260 </div> 261 </div>
261 </div>
262 262
263 <div class="row"> 263 <div class="row">
264 <div class="input-field col s12"> 264 <div class="input-field col s12">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/edit.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/edit.html.twig
new file mode 100644
index 00000000..882be430
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/edit.html.twig
@@ -0,0 +1,60 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'site_credential.edit_site_credential'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(edit_form) }}
16 {{ form_errors(edit_form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(edit_form.host) }}
21 {{ form_errors(edit_form.host) }}
22 {{ form_widget(edit_form.host) }}
23 </div>
24 </div>
25
26 <div class="row">
27 <div class="input-field col s12">
28 {{ form_label(edit_form.username) }}
29 {{ form_errors(edit_form.username) }}
30 {{ form_widget(edit_form.username) }}
31 </div>
32 </div>
33
34 <div class="row">
35 <div class="input-field col s12">
36 {{ form_label(edit_form.password) }}
37 {{ form_errors(edit_form.password) }}
38 {{ form_widget(edit_form.password) }}
39 </div>
40 </div>
41
42 <br/>
43
44 {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
45 {{ form_widget(edit_form._token) }}
46 </form>
47 <p>
48 {{ form_start(delete_form) }}
49 <button onclick="return confirm('{{ 'site_credential.form.delete_confirm'|trans|escape('js') }}')" type="submit" class="btn waves-effect waves-light red">{{ 'site_credential.form.delete'|trans }}</button>
50 {{ form_end(delete_form) }}
51 </p>
52 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credentials_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
53 </div>
54 </div>
55 </div>
56 </div>
57 </div>
58 </div>
59
60{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/index.html.twig
new file mode 100644
index 00000000..324854ad
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/index.html.twig
@@ -0,0 +1,42 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <p class="help">{{ 'site_credential.description'|trans|raw }}</p>
13
14 <table class="bordered">
15 <thead>
16 <tr>
17 <th>{{ 'site_credential.form.host_label'|trans }}</th>
18 <th>{{ 'site_credential.list.actions'|trans }}</th>
19 </tr>
20 </thead>
21 <tbody>
22 {% for credential in credentials %}
23 <tr>
24 <td>{{ credential.host }}</td>
25 <td>
26 <a href="{{ path('site_credentials_edit', { 'id': credential.id }) }}">{{ 'site_credential.list.edit_action'|trans }}</a>
27 </td>
28 </tr>
29 {% endfor %}
30 </tbody>
31 </table>
32 <br />
33 <p>
34 <a href="{{ path('site_credentials_new') }}" class="waves-effect waves-light btn">{{ 'site_credential.list.create_new_one'|trans }}</a>
35 </p>
36 </div>
37 </div>
38 </div>
39 </div>
40 </div>
41
42{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/new.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/new.html.twig
new file mode 100644
index 00000000..3c008cde
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/new.html.twig
@@ -0,0 +1,53 @@
1{% extends "WallabagCoreBundle::layout.html.twig" %}
2
3{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
4
5{% block content %}
6
7 <div class="row">
8 <div class="col s12">
9 <div class="card-panel">
10 <div class="row">
11 <div class="input-field col s12">
12 <h4>{{ 'site_credential.new_site_credential'|trans }}</h4>
13
14 <div id="set6" class="col s12">
15 {{ form_start(form) }}
16 {{ form_errors(form) }}
17
18 <div class="row">
19 <div class="input-field col s12">
20 {{ form_label(form.host) }}
21 {{ form_errors(form.host) }}
22 {{ form_widget(form.host) }}
23 </div>
24 </div>
25
26 <div class="row">
27 <div class="input-field col s12">
28 {{ form_label(form.username) }}
29 {{ form_errors(form.username) }}
30 {{ form_widget(form.username) }}
31 </div>
32 </div>
33
34 <div class="row">
35 <div class="input-field col s12">
36 {{ form_label(form.password) }}
37 {{ form_errors(form.password) }}
38 {{ form_widget(form.password) }}
39 </div>
40 </div>
41
42 {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
43 {{ form_rest(form) }}
44 </form>
45 <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credentials_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
46 </div>
47 </div>
48 </div>
49 </div>
50 </div>
51 </div>
52
53{% endblock %}
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
index 2dab1c18..60907e11 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
@@ -66,6 +66,11 @@
66 <li class="bold {% if currentRoute == 'config' %}active{% endif %}"> 66 <li class="bold {% if currentRoute == 'config' %}active{% endif %}">
67 <a class="waves-effect" href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a> 67 <a class="waves-effect" href="{{ path('config') }}">{{ 'menu.left.config'|trans }}</a>
68 </li> 68 </li>
69 {% if craue_setting('restricted_access') %}
70 <li class="bold {% if currentRoute starts with 'site_credentials_' %}active{% endif %}">
71 <a class="waves-effect" href="{{ path('site_credentials_index') }}">{{ 'menu.left.site_credentials'|trans }}</a>
72 </li>
73 {% endif %}
69 {% if is_granted('ROLE_SUPER_ADMIN') %} 74 {% if is_granted('ROLE_SUPER_ADMIN') %}
70 <li class="bold {% if currentRoute starts with 'user_' %}active{% endif %}"> 75 <li class="bold {% if currentRoute starts with 'user_' %}active{% endif %}">
71 <a class="waves-effect" href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a> 76 <a class="waves-effect" href="{{ path('user_index') }}">{{ 'menu.left.users_management'|trans }}</a>