]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Add CRUD for site credentials
authorJeremy Benoist <jeremy.benoist@gmail.com>
Sun, 4 Dec 2016 12:51:58 +0000 (13:51 +0100)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Tue, 20 Jun 2017 14:03:08 +0000 (16:03 +0200)
24 files changed:
app/DoctrineMigrations/Version20161204115751.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Controller/SiteCredentialController.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Entity/SiteCredential.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/edit.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/index.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/new.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/edit.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/index.html.twig [new file with mode: 0644]
src/Wallabag/CoreBundle/Resources/views/themes/material/SiteCredential/new.html.twig [new file with mode: 0644]

diff --git a/app/DoctrineMigrations/Version20161204115751.php b/app/DoctrineMigrations/Version20161204115751.php
new file mode 100644 (file)
index 0000000..97635fa
--- /dev/null
@@ -0,0 +1,56 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+use Symfony\Component\DependencyInjection\ContainerAwareInterface;
+use Symfony\Component\DependencyInjection\ContainerInterface;
+
+/**
+ * Add site credential table to store username & password for some website (behind authentication or paywall)
+ */
+class Version20161204115751 extends AbstractMigration implements ContainerAwareInterface
+{
+    /**
+     * @var ContainerInterface
+     */
+    private $container;
+
+    public function setContainer(ContainerInterface $container = null)
+    {
+        $this->container = $container;
+    }
+
+    private function getTable($tableName)
+    {
+        return $this->container->getParameter('database_table_prefix').$tableName;
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $this->skipIf($schema->hasTable($this->getTable('site_credential')), 'It seems that you already played this migration.');
+
+        $table = $schema->createTable($this->getTable('site_credential'));
+        $table->addColumn('id', 'integer', ['autoincrement' => true]);
+        $table->addColumn('user_id', 'integer');
+        $table->addColumn('host', 'string', ['length' => 255]);
+        $table->addColumn('username', 'string', ['length' => 255]);
+        $table->addColumn('password', 'string', ['length' => 255]);
+        $table->addColumn('createdAt', 'datetime');
+        $table->addIndex(['user_id'], 'idx_user');
+        $table->setPrimaryKey(['id']);
+        $table->addForeignKeyConstraint($this->getTable('user'), ['user_id'], ['id'], [], 'fk_user');
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+        $schema->dropTable($this->getTable('site_credential'));
+    }
+}
diff --git a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
new file mode 100644 (file)
index 0000000..e7e4380
--- /dev/null
@@ -0,0 +1,138 @@
+<?php
+
+namespace Wallabag\CoreBundle\Controller;
+
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Bundle\FrameworkBundle\Controller\Controller;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
+use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
+use Wallabag\UserBundle\Entity\User;
+use Wallabag\CoreBundle\Entity\SiteCredential;
+
+/**
+ * SiteCredential controller.
+ */
+class SiteCredentialController extends Controller
+{
+    /**
+     * Lists all User entities.
+     *
+     * @Route("/site-credential", name="site_credential_index")
+     * @Method("GET")
+     */
+    public function indexAction()
+    {
+        $em = $this->getDoctrine()->getManager();
+
+        $credentials = $em->getRepository('WallabagCoreBundle:SiteCredential')->findAll();
+
+        return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', array(
+            'credentials' => $credentials,
+        ));
+    }
+
+    /**
+     * Creates a new site credential entity.
+     *
+     * @Route("/site-credential/new", name="site_credential_new")
+     * @Method({"GET", "POST"})
+     */
+    public function newAction(Request $request)
+    {
+        $credential = new SiteCredential($this->getUser());
+
+        $form = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $credential);
+        $form->handleRequest($request);
+
+        if ($form->isSubmitted() && $form->isValid()) {
+            $em = $this->getDoctrine()->getManager();
+            $em->persist($credential);
+            $em->flush($credential);
+
+            $this->get('session')->getFlashBag()->add(
+                'notice',
+                $this->get('translator')->trans('flashes.site_credential.notice.added', ['%host%' => $credential->getHost()])
+            );
+
+            return $this->redirectToRoute('site_credential_edit', array('id' => $credential->getId()));
+        }
+
+        return $this->render('WallabagCoreBundle:SiteCredential:new.html.twig', array(
+            'credential' => $credential,
+            'form' => $form->createView(),
+        ));
+    }
+
+    /**
+     * Displays a form to edit an existing site credential entity.
+     *
+     * @Route("/site-credential/{id}/edit", name="site_credential_edit")
+     * @Method({"GET", "POST"})
+     */
+    public function editAction(Request $request, SiteCredential $siteCredential)
+    {
+        $deleteForm = $this->createDeleteForm($siteCredential);
+        $editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $siteCredential);
+        $editForm->handleRequest($request);
+
+        if ($editForm->isSubmitted() && $editForm->isValid()) {
+            $em = $this->getDoctrine()->getManager();
+            $em->persist($siteCredential);
+            $em->flush();
+
+            $this->get('session')->getFlashBag()->add(
+                'notice',
+                $this->get('translator')->trans('flashes.site_credential.notice.updated', ['%host%' => $siteCredential->getHost()])
+            );
+
+            return $this->redirectToRoute('site_credential_edit', array('id' => $siteCredential->getId()));
+        }
+
+        return $this->render('WallabagCoreBundle:SiteCredential:edit.html.twig', array(
+            'credential' => $siteCredential,
+            'edit_form' => $editForm->createView(),
+            'delete_form' => $deleteForm->createView(),
+        ));
+    }
+
+    /**
+     * Deletes a site credential entity.
+     *
+     * @Route("/site-credential/{id}", name="site_credential_delete")
+     * @Method("DELETE")
+     */
+    public function deleteAction(Request $request, SiteCredential $siteCredential)
+    {
+        $form = $this->createDeleteForm($siteCredential);
+        $form->handleRequest($request);
+
+        if ($form->isSubmitted() && $form->isValid()) {
+            $this->get('session')->getFlashBag()->add(
+                'notice',
+                $this->get('translator')->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()])
+            );
+
+            $em = $this->getDoctrine()->getManager();
+            $em->remove($siteCredential);
+            $em->flush();
+        }
+
+        return $this->redirectToRoute('site_credential_index');
+    }
+
+    /**
+     * Creates a form to delete a site credential entity.
+     *
+     * @param SiteCredential $siteCredential The site credential entity
+     *
+     * @return \Symfony\Component\Form\Form The form
+     */
+    private function createDeleteForm(SiteCredential $siteCredential)
+    {
+        return $this->createFormBuilder()
+            ->setAction($this->generateUrl('site_credential_delete', array('id' => $siteCredential->getId())))
+            ->setMethod('DELETE')
+            ->getForm()
+        ;
+    }
+}
diff --git a/src/Wallabag/CoreBundle/Entity/SiteCredential.php b/src/Wallabag/CoreBundle/Entity/SiteCredential.php
new file mode 100644 (file)
index 0000000..85ee07d
--- /dev/null
@@ -0,0 +1,197 @@
+<?php
+
+namespace Wallabag\CoreBundle\Entity;
+
+use Doctrine\ORM\Mapping as ORM;
+use Symfony\Component\Validator\Constraints as Assert;
+use Wallabag\UserBundle\Entity\User;
+
+/**
+ * SiteCredential.
+ *
+ * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\SiteCredentialRepository")
+ * @ORM\Table(name="`site_credential`")
+ * @ORM\HasLifecycleCallbacks()
+ */
+class SiteCredential
+{
+    /**
+     * @var int
+     *
+     * @ORM\Column(name="id", type="integer")
+     * @ORM\Id
+     * @ORM\GeneratedValue(strategy="AUTO")
+     */
+    private $id;
+
+    /**
+     * @var string
+     *
+     * @Assert\NotBlank()
+     * @Assert\Length(max=255)
+     * @ORM\Column(name="host", type="string", length=255)
+     */
+    private $host;
+
+    /**
+     * @var string
+     *
+     * @Assert\NotBlank()
+     * @Assert\Length(max=255)
+     * @ORM\Column(name="username", type="string", length=255)
+     */
+    private $username;
+
+    /**
+     * @var string
+     *
+     * @Assert\NotBlank()
+     * @Assert\Length(max=255)
+     * @ORM\Column(name="password", type="string", length=255)
+     */
+    private $password;
+
+    /**
+     * @var \DateTime
+     *
+     * @ORM\Column(name="createdAt", type="datetime")
+     */
+    private $createdAt;
+
+    /**
+     * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="site_credentials")
+     */
+    private $user;
+
+    /*
+     * @param User     $user
+     */
+    public function __construct(User $user)
+    {
+        $this->user = $user;
+    }
+
+    /**
+     * Get id.
+     *
+     * @return int
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * Set host.
+     *
+     * @param string $host
+     *
+     * @return SiteCredential
+     */
+    public function setHost($host)
+    {
+        $this->host = $host;
+
+        return $this;
+    }
+
+    /**
+     * Get host.
+     *
+     * @return string
+     */
+    public function getHost()
+    {
+        return $this->host;
+    }
+
+    /**
+     * Set username.
+     *
+     * @param string $username
+     *
+     * @return SiteCredential
+     */
+    public function setUsername($username)
+    {
+        $this->username = $username;
+
+        return $this;
+    }
+
+    /**
+     * Get username.
+     *
+     * @return string
+     */
+    public function getUsername()
+    {
+        return $this->username;
+    }
+
+    /**
+     * Set password.
+     *
+     * @param string $password
+     *
+     * @return SiteCredential
+     */
+    public function setPassword($password)
+    {
+        $this->password = $password;
+
+        return $this;
+    }
+
+    /**
+     * Get password.
+     *
+     * @return string
+     */
+    public function getPassword()
+    {
+        return $this->password;
+    }
+
+    /**
+     * Set createdAt.
+     *
+     * @param \DateTime $createdAt
+     *
+     * @return SiteCredential
+     */
+    public function setCreatedAt($createdAt)
+    {
+        $this->createdAt = $createdAt;
+
+        return $this;
+    }
+
+    /**
+     * Get createdAt.
+     *
+     * @return \DateTime
+     */
+    public function getCreatedAt()
+    {
+        return $this->createdAt;
+    }
+
+    /**
+     * @return User
+     */
+    public function getUser()
+    {
+        return $this->user;
+    }
+
+    /**
+     * @ORM\PrePersist
+     */
+    public function timestamps()
+    {
+        if (is_null($this->createdAt)) {
+            $this->createdAt = new \DateTime();
+        }
+    }
+}
diff --git a/src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php b/src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php
new file mode 100644 (file)
index 0000000..9db7c15
--- /dev/null
@@ -0,0 +1,43 @@
+<?php
+
+namespace Wallabag\CoreBundle\Form\Type;
+
+use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\PasswordType;
+use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\TextType;
+use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
+
+class SiteCredentialType extends AbstractType
+{
+    public function buildForm(FormBuilderInterface $builder, array $options)
+    {
+        $builder
+            ->add('host', TextType::class, [
+                'label' => 'site_credential.form.host_label',
+            ])
+            ->add('username', TextType::class, [
+                'label' => 'site_credential.form.username_label',
+            ])
+            ->add('password', PasswordType::class, [
+                'label' => 'site_credential.form.password_label',
+            ])
+            ->add('save', SubmitType::class, [
+                'label' => 'config.form.save',
+            ])
+        ;
+    }
+
+    public function configureOptions(OptionsResolver $resolver)
+    {
+        $resolver->setDefaults([
+            'data_class' => 'Wallabag\CoreBundle\Entity\SiteCredential',
+        ]);
+    }
+
+    public function getBlockPrefix()
+    {
+        return 'site_credential';
+    }
+}
diff --git a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php
new file mode 100644 (file)
index 0000000..501b443
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace Wallabag\CoreBundle\Repository;
+
+/**
+ * SiteCredentialRepository.
+ *
+ * This class was generated by the Doctrine ORM. Add your own custom
+ * repository methods below.
+ */
+class SiteCredentialRepository extends \Doctrine\ORM\EntityRepository
+{
+}
index 5e7afe27b13f6905a255b2d3af768d34ee3a5078..ef58a16b8d5ca14d04e1dc42f70a9109e2499b9a 100644 (file)
@@ -518,6 +518,26 @@ user:
     search:
         # placeholder: Filter by username or email
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    # list:
+    #     actions: Actions
+    #     edit_action: Edit
+    #     yes: Yes
+    #     no: No
+    #     create_new_one: Create a new credential
+    # form:
+    #     username_label: 'Username'
+    #     host_label: 'Host'
+    #     password_label: 'Password'
+    #     save: Save
+    #     delete: Delete
+    #     delete_confirm: Are you sure?
+    #     back_to_list: Back to list
+
 error:
     # page_title: An error occurred
 
@@ -570,3 +590,8 @@ flashes:
             # added: 'User "%username%" added'
             # updated: 'User "%username%" updated'
             # deleted: 'User "%username%" deleted'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index 00468575967ea1563c08dc9a6262b3e1d8a0a272..d026a030b5b80ccc52bb6de3eae28777a6584249 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         placeholder: Filtere nach Benutzer oder E-Mail-Adresse
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    list:
+        actions: Aktionen
+        edit_action: Bearbeiten
+        yes: Ja
+        no: Nein
+        # create_new_one: Create a new credential
+    form:
+        # username_label: 'Username'
+        # host_label: 'Host'
+        # password_label: 'Password'
+        save: Speichern
+        delete: Löschen
+        delete_confirm: Bist du sicher?
+        back_to_list: Zurück zur Liste
+
 error:
     page_title: Ein Fehler ist aufgetreten
 
@@ -571,3 +591,8 @@ flashes:
             added: 'Benutzer "%username%" hinzugefügt'
             updated: 'Benutzer "%username%" aktualisiert'
             deleted: 'Benutzer "%username%" gelöscht'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index 572084c175c27bf35cba6a08019630c4e8655616..12feb7dd47213184aa04e339c72a63630752e70c 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         placeholder: Filter by username or email
 
+site_credential:
+    page_title: Site credentials management
+    new_site_credential: Create a credential
+    edit_site_credential: Edit an existing credential
+    description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    list:
+        actions: Actions
+        edit_action: Edit
+        yes: Yes
+        no: No
+        create_new_one: Create a new credential
+    form:
+        username_label: 'Username'
+        host_label: 'Host'
+        password_label: 'Password'
+        save: Save
+        delete: Delete
+        delete_confirm: Are you sure?
+        back_to_list: Back to list
+
 error:
     page_title: An error occurred
 
@@ -571,3 +591,8 @@ flashes:
             added: 'User "%username%" added'
             updated: 'User "%username%" updated'
             deleted: 'User "%username%" deleted'
+    site_credential:
+        notice:
+            added: 'Site credential for "%host%" added'
+            updated: 'Site credential for "%host%" updated'
+            deleted: 'Site credential for "%host%" deleted'
index 0f2a4a7b207c55494c4ce8bbb8cd1b4d0a1b4518..2351d467fe6e5158532c6352ca730ea0a37ffaed 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         # placeholder: Filter by username or email
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    # list:
+    #     actions: Actions
+    #     edit_action: Edit
+    #     yes: Yes
+    #     no: No
+    #     create_new_one: Create a new credential
+    # form:
+    #     username_label: 'Username'
+    #     host_label: 'Host'
+    #     password_label: 'Password'
+    #     save: Save
+    #     delete: Delete
+    #     delete_confirm: Are you sure?
+    #     back_to_list: Back to list
+
 error:
     page_title: Ha ocurrido un error
 
@@ -571,3 +591,8 @@ flashes:
             added: 'Añadido el usuario "%username%"'
             updated: 'Actualizado el usuario "%username%"'
             deleted: 'Eliminado el usuario "%username%"'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index a8900489d82dc6d7ffec197feab20cf6c92bce1e..32e1ff42a408adef8aa938310dfe788ea852e0ac 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         # placeholder: Filter by username or email
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    # list:
+    #     actions: Actions
+    #     edit_action: Edit
+    #     yes: Yes
+    #     no: No
+    #     create_new_one: Create a new credential
+    # form:
+    #     username_label: 'Username'
+    #     host_label: 'Host'
+    #     password_label: 'Password'
+    #     save: Save
+    #     delete: Delete
+    #     delete_confirm: Are you sure?
+    #     back_to_list: Back to list
+
 error:
     # page_title: An error occurred
 
@@ -571,3 +591,8 @@ flashes:
             # added: 'User "%username%" added'
             # updated: 'User "%username%" updated'
             # deleted: 'User "%username%" deleted'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index 6969b67b68d8b1fd05921b0ff2e236882774f6a6..e37abfd350ad37eb20d67d200d0fca70a28783c6 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         placeholder: "Filtrer par nom d’utilisateur ou email"
 
+site_credential:
+    page_title: Gestion des accès aux sites
+    new_site_credential: Créer un accès Ã  un site
+    edit_site_credential: Ã‰diter l'accès d'un site
+    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 requiert une authentification ou un paywall"
+    list:
+        actions: Actions
+        edit_action: Ã‰diter
+        yes: Oui
+        no: Non
+        create_new_one: Créer un nouvel accès Ã  un site
+    form:
+        username_label: 'Identifiant'
+        host_label: 'Domaine'
+        password_label: 'Mot de passe'
+        save: "Sauvegarder"
+        delete: "Supprimer"
+        delete_confirm: "Voulez-vous vraiment ?"
+        back_to_list: "Revenir Ã  la liste"
+
 error:
     page_title: "Une erreur est survenue"
 
@@ -568,6 +588,11 @@ flashes:
             client_deleted: "Client %name% supprimé"
     user:
         notice:
-            added: "Utilisateur \"%username%\" ajouté"
-            updated: "Utilisateur \"%username%\" mis Ã  jour"
-            deleted: "Utilisateur \"%username%\" supprimé"
+            added: 'Utilisateur "%username%" ajouté'
+            updated: 'Utilisateur "%username%" mis Ã  jour'
+            deleted: 'Utilisateur "%username%" supprimé'
+    site_credential:
+        notice:
+            added: 'Accès au site "%host%" ajouté'
+            updated: 'Accès au site "%host%" mis Ã  jour'
+            deleted: 'Accès au site "%host%" supprimé'
index c20070570114c648f6a7014f0d50347554559764..752085c8005e2a793832714c9d518acc0c50033b 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         # placeholder: Filter by username or email
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    # list:
+    #     actions: Actions
+    #     edit_action: Edit
+    #     yes: Yes
+    #     no: No
+    #     create_new_one: Create a new credential
+    # form:
+    #     username_label: 'Username'
+    #     host_label: 'Host'
+    #     password_label: 'Password'
+    #     save: Save
+    #     delete: Delete
+    #     delete_confirm: Are you sure?
+    #     back_to_list: Back to list
+
 error:
     # page_title: An error occurred
 
@@ -571,3 +591,8 @@ flashes:
             # added: 'User "%username%" added'
             # updated: 'User "%username%" updated'
             # deleted: 'User "%username%" deleted'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index 3ac472d03731651802a2025d9fb7bf58dbe5dae3..9e941de0a3f90a33b0168f6e30f10ce09df89266 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         placeholder: "Filtrar per nom d'utilizaire o corrièl"
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    list:
+         actions: 'Accions'
+         edit_action: 'Modificar'
+         yes: 'Ã’c'
+         no: 'Non'
+        # create_new_one: Create a new credential
+    form:
+        # username_label: 'Username'
+        # host_label: 'Host'
+        # password_label: 'Password'
+        save: 'Enregistrar'
+        delete: 'Suprimir'
+        delete_confirm: 'Sètz segur ?'
+        back_to_list: 'Tornar a la lista'
+
 error:
     page_title: Una error s'es produsida
 
@@ -571,3 +591,8 @@ flashes:
             added: 'Utilizaire "%username%" ajustat'
             updated: 'Utilizaire "%username%" mes a jorn'
             deleted: 'Utilizaire "%username%" suprimit'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index fa6723871eaa85c1891dde04dbc8d25c355f075f..38e051f583a73efbb1d731871d215afc0a004ab9 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         placeholder: Filtruj po nazwie użytkownika lub adresie e-mail
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    list:
+        actions: Akcje
+        edit_action: Edytuj
+        yes: Tak
+        no: Nie
+        # create_new_one: Create a new credential
+    form:
+        # username_label: 'Username'
+        # host_label: 'Host'
+        # password_label: 'Password'
+        save: Zapisz
+        delete: UsuÅ„
+        delete_confirm: JesteÅ› pewien?
+        back_to_list: Powrót do listy
+
 error:
     page_title: WystÄ…piÅ‚ bÅ‚Ä…d
 
@@ -571,3 +591,8 @@ flashes:
             added: 'Użytkownik "%username%" dodany'
             updated: 'Użytkownik "%username%" zaktualizowany'
             deleted: 'Użytkownik "%username%" usuniÄ™ty'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index 896ccb04d4579ff447eeea7f0fcafde08a647c75..d3b245b834224c245ad86d7255bfd13ed6a719da 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         # placeholder: Filter by username or email
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    list:
+        actions: 'Ações'
+        edit_action: 'Editar'
+        yes: 'Sim'
+        no: 'Não'
+        # create_new_one: Create a new credential
+    form:
+        # username_label: 'Username'
+        # host_label: 'Host'
+        # password_label: 'Password'
+        save: 'Salvar'
+        delete: 'Apagar'
+        delete_confirm: 'Tem certeza?'
+        back_to_list: 'Voltar para a lista'
+
 error:
     # page_title: An error occurred
 
@@ -571,3 +591,8 @@ flashes:
             added: 'Usuário "%username%" adicionado'
             updated: 'Usuário "%username%" atualizado'
             deleted: 'Usuário "%username%" removido'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index c447dc9bf65e25b7743b400ff31bc82aa96ca4e3..66c7242996d21478ac174cf2e698e347c4703349 100644 (file)
@@ -519,6 +519,26 @@ user:
     search:
         # placeholder: Filter by username or email
 
+site_credential:
+    # page_title: Site credentials management
+    # new_site_credential: Create a credential
+    # edit_site_credential: Edit an existing credential
+    # description: "Here you can manage all credentials for sites which required them (create, edit and delete), like a paywall, an authentication, etc."
+    # list:
+    #     actions: Actions
+    #     edit_action: Edit
+    #     yes: Yes
+    #     no: No
+    #     create_new_one: Create a new credential
+    # form:
+    #     username_label: 'Username'
+    #     host_label: 'Host'
+    #     password_label: 'Password'
+    #     save: Save
+    #     delete: Delete
+    #     delete_confirm: Are you sure?
+    #     back_to_list: Back to list
+
 error:
     # page_title: An error occurred
 
@@ -571,3 +591,8 @@ flashes:
             # added: 'User "%username%" added'
             # updated: 'User "%username%" updated'
             # deleted: 'User "%username%" deleted'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # deleted: 'Site credential for "%host%" deleted'
index 61e1a1ea7659e9169451569d5715a60254914d45..34ae5b8777dbde676e328cc7794745a3dbab6388 100644 (file)
@@ -571,3 +571,8 @@ flashes:
             # added: 'User "%username%" added'
             # updated: 'User "%username%" updated'
             # deleted: 'User "%username%" deleted'
+    site_credential:
+        notice:
+            # added: 'Site credential for "%host%" added'
+            # updated: 'Site credential for "%host%" updated'
+            # 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 (file)
index 0000000..8448f17
--- /dev/null
@@ -0,0 +1,60 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
+
+{% block content %}
+
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel">
+                <div class="row">
+                    <div class="input-field col s12">
+                        <h4>{{ 'site_credential.edit_site_credential'|trans }}</h4>
+
+                        <div id="set6" class="col s12">
+                            {{ form_start(edit_form) }}
+                                {{ form_errors(edit_form) }}
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.host) }}
+                                        {{ form_errors(edit_form.host) }}
+                                        {{ form_widget(edit_form.host) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.username) }}
+                                        {{ form_errors(edit_form.username) }}
+                                        {{ form_widget(edit_form.username) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.password) }}
+                                        {{ form_errors(edit_form.password) }}
+                                        {{ form_widget(edit_form.password) }}
+                                    </div>
+                                </div>
+
+                                <br/>
+
+                                {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
+                                {{ form_widget(edit_form._token) }}
+                            </form>
+                            <p>
+                                {{ form_start(delete_form) }}
+                                    <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>
+                                {{ form_end(delete_form) }}
+                            </p>
+                            <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+{% 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 (file)
index 0000000..fda60b3
--- /dev/null
@@ -0,0 +1,44 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
+
+{% block content %}
+
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel">
+                <div class="row">
+                    <div class="input-field col s12">
+                        <p class="help">{{ 'site_credential.description'|trans|raw }}</p>
+
+                        <table class="bordered">
+                            <thead>
+                                <tr>
+                                    <th>{{ 'site_credential.form.host_label'|trans }}</th>
+                                    <th>{{ 'site_credential.form.username_label'|trans }}</th>
+                                    <th>{{ 'site_credential.list.actions'|trans }}</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                            {% for credential in credentials %}
+                                <tr>
+                                    <td>{{ credential.host }}</td>
+                                    <td>{{ credential.username }}</td>
+                                    <td>
+                                        <a href="{{ path('site_credential_edit', { 'id': credential.id }) }}">{{ 'site_credential.list.edit_action'|trans }}</a>
+                                    </td>
+                                </tr>
+                            {% endfor %}
+                            </tbody>
+                        </table>
+                        <br />
+                        <p>
+                            <a href="{{ path('site_credential_new') }}" class="waves-effect waves-light btn">{{ 'site_credential.list.create_new_one'|trans }}</a>
+                        </p>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+{% 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 (file)
index 0000000..bf71390
--- /dev/null
@@ -0,0 +1,53 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
+
+{% block content %}
+
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel">
+                <div class="row">
+                    <div class="input-field col s12">
+                        <h4>{{ 'site_credential.new_site_credential'|trans }}</h4>
+
+                        <div id="set6" class="col s12">
+                            {{ form_start(form) }}
+                                {{ form_errors(form) }}
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(form.host) }}
+                                        {{ form_errors(form.host) }}
+                                        {{ form_widget(form.host) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(form.username) }}
+                                        {{ form_errors(form.username) }}
+                                        {{ form_widget(form.username) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(form.password) }}
+                                        {{ form_errors(form.password) }}
+                                        {{ form_widget(form.password) }}
+                                    </div>
+                                </div>
+
+                                {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
+                                {{ form_rest(form) }}
+                            </form>
+                            <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+{% endblock %}
index 9b0816eb51eda730be31ee4c8f288c1a5c292607..1e10bf38abc5bf160c7833f207ad2d19850b5ba8 100644 (file)
                                 </div>
                             </div>
 
-                        <div class="row">
-                            <div class="input-field col s12">
-                                {{ form_errors(form.config.action_mark_as_read) }}
-                                {{ form_widget(form.config.action_mark_as_read) }}
-                                {{ form_label(form.config.action_mark_as_read) }}
+                            <div class="row">
+                                <div class="input-field col s12">
+                                    {{ form_label(form.config.action_mark_as_read) }}
+                                    {{ form_errors(form.config.action_mark_as_read) }}
+                                    {{ form_widget(form.config.action_mark_as_read) }}
+                                </div>
                             </div>
-                        </div>
 
                             <div class="row">
                                 <div class="input-field col s11">
                         {{ form_start(form.pwd) }}
                             {{ form_errors(form.pwd) }}
 
-                        <div class="row">
-                            <div class="input-field col s12">
-                                {{ 'config.form_password.description'|trans }}
+                            <div class="row">
+                                <div class="input-field col s12">
+                                    {{ 'config.form_password.description'|trans }}
+                                </div>
                             </div>
-                        </div>
 
                             <div class="row">
                                 <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 (file)
index 0000000..8448f17
--- /dev/null
@@ -0,0 +1,60 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
+
+{% block content %}
+
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel">
+                <div class="row">
+                    <div class="input-field col s12">
+                        <h4>{{ 'site_credential.edit_site_credential'|trans }}</h4>
+
+                        <div id="set6" class="col s12">
+                            {{ form_start(edit_form) }}
+                                {{ form_errors(edit_form) }}
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.host) }}
+                                        {{ form_errors(edit_form.host) }}
+                                        {{ form_widget(edit_form.host) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.username) }}
+                                        {{ form_errors(edit_form.username) }}
+                                        {{ form_widget(edit_form.username) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(edit_form.password) }}
+                                        {{ form_errors(edit_form.password) }}
+                                        {{ form_widget(edit_form.password) }}
+                                    </div>
+                                </div>
+
+                                <br/>
+
+                                {{ form_widget(edit_form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
+                                {{ form_widget(edit_form._token) }}
+                            </form>
+                            <p>
+                                {{ form_start(delete_form) }}
+                                    <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>
+                                {{ form_end(delete_form) }}
+                            </p>
+                            <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+{% 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 (file)
index 0000000..fda60b3
--- /dev/null
@@ -0,0 +1,44 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
+
+{% block content %}
+
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel">
+                <div class="row">
+                    <div class="input-field col s12">
+                        <p class="help">{{ 'site_credential.description'|trans|raw }}</p>
+
+                        <table class="bordered">
+                            <thead>
+                                <tr>
+                                    <th>{{ 'site_credential.form.host_label'|trans }}</th>
+                                    <th>{{ 'site_credential.form.username_label'|trans }}</th>
+                                    <th>{{ 'site_credential.list.actions'|trans }}</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                            {% for credential in credentials %}
+                                <tr>
+                                    <td>{{ credential.host }}</td>
+                                    <td>{{ credential.username }}</td>
+                                    <td>
+                                        <a href="{{ path('site_credential_edit', { 'id': credential.id }) }}">{{ 'site_credential.list.edit_action'|trans }}</a>
+                                    </td>
+                                </tr>
+                            {% endfor %}
+                            </tbody>
+                        </table>
+                        <br />
+                        <p>
+                            <a href="{{ path('site_credential_new') }}" class="waves-effect waves-light btn">{{ 'site_credential.list.create_new_one'|trans }}</a>
+                        </p>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+{% 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 (file)
index 0000000..bf71390
--- /dev/null
@@ -0,0 +1,53 @@
+{% extends "WallabagCoreBundle::layout.html.twig" %}
+
+{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %}
+
+{% block content %}
+
+    <div class="row">
+        <div class="col s12">
+            <div class="card-panel">
+                <div class="row">
+                    <div class="input-field col s12">
+                        <h4>{{ 'site_credential.new_site_credential'|trans }}</h4>
+
+                        <div id="set6" class="col s12">
+                            {{ form_start(form) }}
+                                {{ form_errors(form) }}
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(form.host) }}
+                                        {{ form_errors(form.host) }}
+                                        {{ form_widget(form.host) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(form.username) }}
+                                        {{ form_errors(form.username) }}
+                                        {{ form_widget(form.username) }}
+                                    </div>
+                                </div>
+
+                                <div class="row">
+                                    <div class="input-field col s12">
+                                        {{ form_label(form.password) }}
+                                        {{ form_errors(form.password) }}
+                                        {{ form_widget(form.password) }}
+                                    </div>
+                                </div>
+
+                                {{ form_widget(form.save, {'attr': {'class': 'btn waves-effect waves-light'}}) }}
+                                {{ form_rest(form) }}
+                            </form>
+                            <p><a class="waves-effect waves-light btn blue-grey" href="{{ path('site_credential_index') }}">{{ 'site_credential.form.back_to_list'|trans }}</a></p>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+
+{% endblock %}