diff --git a/.gitignore b/.gitignore index 709f78cf2..8fd762fa8 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ app/Resources/build/ # Test-generated files admin-export.json specialexport.json +/data/site-credentials-secret-key.txt diff --git a/app/DoctrineMigrations/Version20170501115751.php b/app/DoctrineMigrations/Version20170501115751.php new file mode 100644 index 000000000..7f068eb84 --- /dev/null +++ b/app/DoctrineMigrations/Version20170501115751.php @@ -0,0 +1,61 @@ +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', 'text'); + $table->addColumn('password', 'text'); + $table->addColumn('createdAt', 'datetime'); + $table->addIndex(['user_id'], 'idx_user'); + $table->setPrimaryKey(['id']); + $table->addForeignKeyConstraint($this->getTable('user'), ['user_id'], ['id'], [], 'fk_user'); + + if ('postgresql' === $this->connection->getDatabasePlatform()->getName()) { + $schema->dropSequence('site_credential_id_seq'); + $schema->createSequence('site_credential_id_seq'); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $schema->dropTable($this->getTable('site_credential')); + } +} diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 914fb1efc..b3fe11c87 100644 --- a/app/config/parameters.yml.dist +++ b/app/config/parameters.yml.dist @@ -60,6 +60,3 @@ parameters: redis_port: 6379 redis_path: null redis_password: null - - # sites credentials - sites_credentials: {} diff --git a/app/config/wallabag.yml b/app/config/wallabag.yml index 51b7e4e30..b45934e4b 100644 --- a/app/config/wallabag.yml +++ b/app/config/wallabag.yml @@ -26,6 +26,7 @@ wallabag_core: fetching_error_message: | wallabag can't retrieve contents for this article. Please troubleshoot this issue. api_limit_mass_actions: 10 + encryption_key_path: "%kernel.root_dir%/../data/site-credentials-secret-key.txt" default_internal_settings: - name: share_public diff --git a/composer.json b/composer.json index 0a170c168..7428f688c 100644 --- a/composer.json +++ b/composer.json @@ -73,7 +73,7 @@ "kphoen/rulerz-bundle": "~0.13", "guzzlehttp/guzzle": "^5.3.1", "doctrine/doctrine-migrations-bundle": "^1.0", - "paragonie/random_compat": "~1.0", + "paragonie/random_compat": "~2.0", "craue/config-bundle": "~2.0", "mnapoli/piwik-twig-extension": "^1.0", "ocramius/proxy-manager": "1.*", @@ -83,7 +83,8 @@ "javibravo/simpleue": "^1.0", "symfony/dom-crawler": "^3.1", "friendsofsymfony/jsrouting-bundle": "^1.6", - "bdunogier/guzzle-site-authenticator": "^1.0.0@dev" + "bdunogier/guzzle-site-authenticator": "^1.0.0@dev", + "defuse/php-encryption": "^2.1" }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "~2.2", diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 0f119377f..eb725a59a 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -313,6 +313,8 @@ class InstallCommand extends ContainerAwareCommand $this ->runCommand('doctrine:migrations:migrate', ['--no-interaction' => true]); + + return $this; } /** diff --git a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php new file mode 100644 index 000000000..98781dab0 --- /dev/null +++ b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php @@ -0,0 +1,174 @@ +get('wallabag_core.site_credential_repository')->findByUser($this->getUser()); + + return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', [ + 'credentials' => $credentials, + ]); + } + + /** + * Creates a new site credential entity. + * + * @Route("/new", name="site_credentials_new") + * @Method({"GET", "POST"}) + * + * @param Request $request + * + * @return \Symfony\Component\HttpFoundation\Response + */ + 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()) { + $credential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getUsername())); + $credential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getPassword())); + + $em = $this->getDoctrine()->getManager(); + $em->persist($credential); + $em->flush(); + + $this->get('session')->getFlashBag()->add( + 'notice', + $this->get('translator')->trans('flashes.site_credential.notice.added', ['%host%' => $credential->getHost()]) + ); + + return $this->redirectToRoute('site_credentials_index'); + } + + return $this->render('WallabagCoreBundle:SiteCredential:new.html.twig', [ + 'credential' => $credential, + 'form' => $form->createView(), + ]); + } + + /** + * Displays a form to edit an existing site credential entity. + * + * @Route("/{id}/edit", name="site_credentials_edit") + * @Method({"GET", "POST"}) + * + * @param Request $request + * @param SiteCredential $siteCredential + * + * @return \Symfony\Component\HttpFoundation\Response + */ + public function editAction(Request $request, SiteCredential $siteCredential) + { + $this->checkUserAction($siteCredential); + + $deleteForm = $this->createDeleteForm($siteCredential); + $editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $siteCredential); + $editForm->handleRequest($request); + + if ($editForm->isSubmitted() && $editForm->isValid()) { + $siteCredential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getUsername())); + $siteCredential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getPassword())); + + $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_credentials_index'); + } + + return $this->render('WallabagCoreBundle:SiteCredential:edit.html.twig', [ + 'credential' => $siteCredential, + 'edit_form' => $editForm->createView(), + 'delete_form' => $deleteForm->createView(), + ]); + } + + /** + * Deletes a site credential entity. + * + * @Route("/{id}", name="site_credentials_delete") + * @Method("DELETE") + * + * @param Request $request + * @param SiteCredential $siteCredential + * + * @return \Symfony\Component\HttpFoundation\RedirectResponse + */ + public function deleteAction(Request $request, SiteCredential $siteCredential) + { + $this->checkUserAction($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_credentials_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_credentials_delete', ['id' => $siteCredential->getId()])) + ->setMethod('DELETE') + ->getForm() + ; + } + + /** + * Check if the logged user can manage the given site credential. + * + * @param SiteCredential $siteCredential The site credential entity + */ + private function checkUserAction(SiteCredential $siteCredential) + { + if (null === $this->getUser() || $this->getUser()->getId() != $siteCredential->getUser()->getId()) { + throw $this->createAccessDeniedException('You can not access this site credential.'); + } + } +} diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php new file mode 100644 index 000000000..866f55a40 --- /dev/null +++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadSiteCredentialData.php @@ -0,0 +1,34 @@ +getReference('admin-user')); + $credential->setHost('example.com'); + $credential->setUsername('foo'); + $credential->setPassword('bar'); + + $manager->persist($credential); + + $manager->flush(); + } + + /** + * {@inheritdoc} + */ + public function getOrder() + { + return 50; + } +} diff --git a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php index 33df92d3c..a9791f6be 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/Configuration.php @@ -63,6 +63,8 @@ class Configuration implements ConfigurationInterface ->end() ->end() ->end() + ->scalarNode('encryption_key_path') + ->end() ->end() ; diff --git a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php index b4d8a3866..532ce2386 100644 --- a/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php +++ b/src/Wallabag/CoreBundle/DependencyInjection/WallabagCoreExtension.php @@ -29,6 +29,7 @@ class WallabagCoreExtension extends Extension $container->setParameter('wallabag_core.fetching_error_message_title', $config['fetching_error_message_title']); $container->setParameter('wallabag_core.api_limit_mass_actions', $config['api_limit_mass_actions']); $container->setParameter('wallabag_core.default_internal_settings', $config['default_internal_settings']); + $container->setParameter('wallabag_core.site_credentials.encryption_key_path', $config['encryption_key_path']); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); $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 000000000..58075e928 --- /dev/null +++ b/src/Wallabag/CoreBundle/Entity/SiteCredential.php @@ -0,0 +1,195 @@ +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 index 000000000..fd409ad2c --- /dev/null +++ b/src/Wallabag/CoreBundle/Form/Type/SiteCredentialType.php @@ -0,0 +1,44 @@ +add('host', TextType::class, [ + 'label' => 'site_credential.form.host_label', + ]) + ->add('username', TextType::class, [ + 'label' => 'site_credential.form.username_label', + 'data' => '', + ]) + ->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/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php index 1c56fa9f4..a79e6ebed 100644 --- a/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php +++ b/src/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilder.php @@ -6,6 +6,8 @@ use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfigBuilder; use Graby\SiteConfig\ConfigBuilder; use Psr\Log\LoggerInterface; +use Wallabag\CoreBundle\Repository\SiteCredentialRepository; +use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; class GrabySiteConfigBuilder implements SiteConfigBuilder { @@ -13,27 +15,39 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder * @var ConfigBuilder */ private $grabyConfigBuilder; + /** - * @var array + * @var SiteCredentialRepository */ - private $credentials; + private $credentialRepository; + /** * @var LoggerInterface */ private $logger; + /** + * @var Wallabag\UserBundle\Entity\User|null + */ + private $currentUser; + /** * GrabySiteConfigBuilder constructor. * - * @param ConfigBuilder $grabyConfigBuilder - * @param array $credentials - * @param LoggerInterface $logger + * @param ConfigBuilder $grabyConfigBuilder + * @param TokenStorage $token + * @param SiteCredentialRepository $credentialRepository + * @param LoggerInterface $logger */ - public function __construct(ConfigBuilder $grabyConfigBuilder, array $credentials, LoggerInterface $logger) + public function __construct(ConfigBuilder $grabyConfigBuilder, TokenStorage $token, SiteCredentialRepository $credentialRepository, LoggerInterface $logger) { $this->grabyConfigBuilder = $grabyConfigBuilder; - $this->credentials = $credentials; + $this->credentialRepository = $credentialRepository; $this->logger = $logger; + + if ($token->getToken()) { + $this->currentUser = $token->getToken()->getUser(); + } } /** @@ -47,7 +61,12 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder $host = substr($host, 4); } - if (empty($this->credentials[$host])) { + $credentials = null; + if ($this->currentUser) { + $credentials = $this->credentialRepository->findOneByHostAndUser($host, $this->currentUser->getId()); + } + + if (null === $credentials) { $this->logger->debug('Auth: no credentials available for host.', ['host' => $host]); return false; @@ -62,13 +81,14 @@ class GrabySiteConfigBuilder implements SiteConfigBuilder 'passwordField' => $config->login_password_field ?: null, 'extraFields' => $this->processExtraFields($config->login_extra_fields), 'notLoggedInXpath' => $config->not_logged_in_xpath ?: null, - 'username' => $this->credentials[$host]['username'], - 'password' => $this->credentials[$host]['password'], + 'username' => $credentials['username'], + 'password' => $credentials['password'], ]; $config = new SiteConfig($parameters); - // do not leak password in log + // do not leak usernames and passwords in log + $parameters['username'] = '**masked**'; $parameters['password'] = '**masked**'; $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 000000000..e8b19cb9e --- /dev/null +++ b/src/Wallabag/CoreBundle/Helper/CryptoProxy.php @@ -0,0 +1,86 @@ +logger = $logger; + + if (!file_exists($encryptionKeyPath)) { + $key = Key::createNewRandomKey(); + + file_put_contents($encryptionKeyPath, $key->saveToAsciiSafeString()); + chmod($encryptionKeyPath, 0600); + } + + $this->encryptionKey = file_get_contents($encryptionKeyPath); + } + + /** + * Ensure the given value will be crypted. + * + * @param string $secretValue Secret valye to crypt + * + * @return string + */ + public function crypt($secretValue) + { + $this->logger->debug('Crypto: crypting value: '.$this->mask($secretValue)); + + return Crypto::encrypt($secretValue, $this->loadKey()); + } + + /** + * Ensure the given crypted value will be decrypted. + * + * @param string $cryptedValue The value to be decrypted + * + * @return string + */ + public function decrypt($cryptedValue) + { + $this->logger->debug('Crypto: decrypting value: '.$this->mask($cryptedValue)); + + try { + return Crypto::decrypt($cryptedValue, $this->loadKey()); + } catch (WrongKeyOrModifiedCiphertextException $e) { + throw new \RuntimeException('Decrypt fail: '.$e->getMessage()); + } + } + + /** + * Load the private key. + * + * @return Key + */ + private function loadKey() + { + return Key::loadFromAsciiSafeString($this->encryptionKey); + } + + /** + * Keep first and last character and put some stars in between. + * + * @param string $value Value to mask + * + * @return string + */ + private function mask($value) + { + return strlen($value) > 0 ? $value[0].'*****'.$value[strlen($value) - 1] : 'Empty value'; + } +} diff --git a/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php new file mode 100644 index 000000000..369067612 --- /dev/null +++ b/src/Wallabag/CoreBundle/Repository/SiteCredentialRepository.php @@ -0,0 +1,47 @@ +cryptoProxy = $cryptoProxy; + } + + /** + * Retrieve one username/password for the given host and userId. + * + * @param string $host + * @param int $userId + * + * @return null|array + */ + public function findOneByHostAndUser($host, $userId) + { + $res = $this->createQueryBuilder('s') + ->select('s.username', 's.password') + ->where('s.host = :hostname')->setParameter('hostname', $host) + ->andWhere('s.user = :userId')->setParameter('userId', $userId) + ->setMaxResults(1) + ->getQuery() + ->getOneOrNullResult(); + + if (null === $res) { + return; + } + + // decrypt user & password before returning them + $res['username'] = $this->cryptoProxy->decrypt($res['username']); + $res['password'] = $this->cryptoProxy->decrypt($res['password']); + + return $res; + } +} diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 4be795470..e09b0f185 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -63,7 +63,8 @@ services: class: Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder arguments: - "@wallabag_core.graby.config_builder" - - "%sites_credentials%" + - "@security.token_storage" + - "@wallabag_core.site_credential_repository" - '@logger' tags: - { name: monolog.logger, channel: graby } @@ -120,6 +121,14 @@ services: arguments: - WallabagCoreBundle:Tag + wallabag_core.site_credential_repository: + class: Wallabag\CoreBundle\Repository\SiteCredentialRepository + factory: [ "@doctrine.orm.default_entity_manager", getRepository ] + arguments: + - WallabagCoreBundle:SiteCredential + calls: + - [ setCrypto, [ "@wallabag_core.helper.crypto_proxy" ] ] + wallabag_core.helper.entries_export: class: Wallabag\CoreBundle\Helper\EntriesExport arguments: @@ -201,3 +210,9 @@ services: wallabag_core.entry.download_images.client: class: GuzzleHttp\Client + + wallabag_core.helper.crypto_proxy: + class: Wallabag\CoreBundle\Helper\CryptoProxy + arguments: + - "%wallabag_core.site_credentials.encryption_key_path%" + - "@logger" diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml index 02dd04f2e..a91a0ce4e 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml @@ -32,6 +32,7 @@ menu: # save_link: 'Save a link' back_to_unread: 'Tilbage til de ulæste artikler' # users_management: 'Users management' + # site_credentials: 'Site credentials' top: add_new_entry: 'Tilføj ny artikel' search: 'Søg' @@ -520,6 +521,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 @@ -572,3 +593,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/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml index f6ccdae0a..e77cdca30 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml @@ -32,6 +32,7 @@ menu: save_link: 'Link speichern' back_to_unread: 'Zurück zu ungelesenen Artikeln' users_management: 'Benutzerverwaltung' + # site_credentials: 'Site credentials' top: add_new_entry: 'Neuen Artikel hinzufügen' search: 'Suche' @@ -521,6 +522,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 @@ -573,3 +594,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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml index 902c3046e..50edab3a0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml @@ -32,6 +32,7 @@ menu: save_link: 'Save a link' back_to_unread: 'Back to unread articles' users_management: 'Users management' + site_credentials: 'Site credentials' top: add_new_entry: 'Add a new entry' search: 'Search' @@ -521,6 +522,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 @@ -573,3 +594,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/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml index afd6a7b15..6fbf00eb4 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml @@ -32,6 +32,7 @@ menu: save_link: 'Guardar un enlace' back_to_unread: 'Volver a los artículos sin leer' users_management: 'Configuración de usuarios' + # site_credentials: 'Site credentials' top: add_new_entry: 'Añadir un nuevo artículo' search: 'Buscar' @@ -521,6 +522,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 @@ -573,3 +594,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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml index 545514b3b..ad7d6cd98 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml @@ -32,6 +32,7 @@ menu: save_link: 'ذخیرهٔ یک پیوند' back_to_unread: 'بازگشت به خواندهنشدهها' # users_management: 'Users management' + # site_credentials: 'Site credentials' top: add_new_entry: 'افزودن مقالهٔ تازه' search: 'جستجو' @@ -521,6 +522,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 @@ -573,3 +594,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/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index e9e79c670..c4b029c3c 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -32,6 +32,7 @@ menu: save_link: "Sauvegarder un nouvel article" back_to_unread: "Retour aux articles non lus" users_management: "Gestion des utilisateurs" + site_credentials: 'Accès aux sites' top: add_new_entry: "Sauvegarder un nouvel article" search: "Rechercher" @@ -516,11 +517,31 @@ user: twofactor_label: "Double authentification" save: "Sauvegarder" delete: "Supprimer" - delete_confirm: "Voulez-vous vraiment ?" + delete_confirm: "Êtes-vous sûr ?" back_to_list: "Revenir à la liste" 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 requièrent 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: "Êtes-vous sûr ?" + back_to_list: "Revenir à la liste" + error: page_title: "Une erreur est survenue" @@ -570,6 +591,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é' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml index 0597d3e3a..4bd04aadb 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml @@ -32,6 +32,7 @@ menu: save_link: 'Salva collegamento' back_to_unread: 'Torna ai contenuti non letti' # users_management: 'Users management' + # site_credentials: 'Site credentials' top: add_new_entry: 'Aggiungi un nuovo contenuto' search: 'Cerca' @@ -521,6 +522,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 @@ -573,3 +594,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/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml index c172a0f6b..a6dd4dcd0 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml @@ -32,6 +32,7 @@ menu: save_link: 'Enregistrar un novèl article' back_to_unread: 'Tornar als articles pas legits' users_management: 'Gestion dels utilizaires' + # site_credentials: 'Site credentials' top: add_new_entry: 'Enregistrar un novèl article' search: 'Cercar' @@ -521,6 +522,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 @@ -573,3 +594,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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml index 82d167671..7312abd79 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml @@ -32,6 +32,7 @@ menu: save_link: 'Zapisz link' back_to_unread: 'Powrót do nieprzeczytanych artykułów' users_management: 'Zarządzanie użytkownikami' + # site_credentials: 'Site credentials' top: add_new_entry: 'Dodaj nowy wpis' search: 'Szukaj' @@ -521,6 +522,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 @@ -573,3 +594,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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml index b75567d62..18090352d 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml @@ -32,6 +32,7 @@ menu: save_link: 'Salvar um link' back_to_unread: 'Voltar para os artigos não lidos' users_management: 'Gestão de Usuários' + # site_credentials: 'Site credentials' top: add_new_entry: 'Adicionar uma nova entrada' search: 'Pesquisa' @@ -521,6 +522,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 @@ -573,3 +594,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' diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml index 95df573dd..f8866fdc1 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml @@ -32,6 +32,7 @@ menu: # save_link: 'Save a link' back_to_unread: 'Înapoi la articolele necitite' # users_management: 'Users management' + # site_credentials: 'Site credentials' top: add_new_entry: 'Introdu un nou articol' search: 'Căutare' @@ -521,6 +522,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 @@ -573,3 +594,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/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml index 61e1a1ea7..4d01e7f75 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml @@ -32,6 +32,7 @@ menu: # save_link: 'Save a link' back_to_unread: 'Okunmayan makalelere geri dön' # users_management: 'Users management' + # site_credentials: 'Site credentials' top: add_new_entry: 'Yeni bir makale ekle' search: 'Ara' @@ -571,3 +572,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 index 000000000..882be430f --- /dev/null +++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/SiteCredential/edit.html.twig @@ -0,0 +1,60 @@ +{% extends "WallabagCoreBundle::layout.html.twig" %} + +{% block title %}{{ 'site_credential.page_title'|trans }}{% endblock %} + +{% block content %} + +
+ {{ form_start(delete_form) }} + + {{ form_end(delete_form) }} +
+ +{{ 'site_credential.description'|trans|raw }}
+ +{{ 'site_credential.form.host_label'|trans }} | +{{ 'site_credential.list.actions'|trans }} | +
---|---|
{{ credential.host }} | ++ {{ 'site_credential.list.edit_action'|trans }} + | +
+ {{ form_start(delete_form) }} + + {{ form_end(delete_form) }} +
+ +{{ 'site_credential.description'|trans|raw }}
+ +{{ 'site_credential.form.host_label'|trans }} | +{{ 'site_credential.list.actions'|trans }} | +
---|---|
{{ credential.host }} | ++ {{ 'site_credential.list.edit_action'|trans }} + | +