From f92fcb53ca78cc8822962e676b0db117e1a08aa5 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 4 Dec 2016 13:51:58 +0100 Subject: Add CRUD for site credentials --- app/DoctrineMigrations/Version20161204115751.php | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 app/DoctrineMigrations/Version20161204115751.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20161204115751.php b/app/DoctrineMigrations/Version20161204115751.php new file mode 100644 index 00000000..97635fa7 --- /dev/null +++ b/app/DoctrineMigrations/Version20161204115751.php @@ -0,0 +1,56 @@ +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')); + } +} -- cgit v1.2.3 From 5a9bc00726ddaf7c8798d4932d0a8b7a38422670 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Mon, 1 May 2017 22:13:17 +0200 Subject: Retrieve username/password from database Inject the current user & the repo to retrieve username/password from the database --- app/config/parameters.yml.dist | 3 --- 1 file changed, 3 deletions(-) (limited to 'app') diff --git a/app/config/parameters.yml.dist b/app/config/parameters.yml.dist index 914fb1ef..b3fe11c8 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: {} -- cgit v1.2.3 From fd7fde95159828960784a438c4b4da147e20ab18 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 2 May 2017 08:38:22 +0200 Subject: Force sequence creation for postgresql --- app/DoctrineMigrations/Version20161204115751.php | 56 ---------------------- app/DoctrineMigrations/Version20170501115751.php | 61 ++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 56 deletions(-) delete mode 100644 app/DoctrineMigrations/Version20161204115751.php create mode 100644 app/DoctrineMigrations/Version20170501115751.php (limited to 'app') diff --git a/app/DoctrineMigrations/Version20161204115751.php b/app/DoctrineMigrations/Version20161204115751.php deleted file mode 100644 index 97635fa7..00000000 --- a/app/DoctrineMigrations/Version20161204115751.php +++ /dev/null @@ -1,56 +0,0 @@ -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/app/DoctrineMigrations/Version20170501115751.php b/app/DoctrineMigrations/Version20170501115751.php new file mode 100644 index 00000000..846a87b5 --- /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', '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'); + + 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')); + } +} -- cgit v1.2.3 From 906424c1b6fd884bf2081bfe6dd0b1f9651c2801 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Sun, 11 Jun 2017 23:05:19 +0200 Subject: Crypt site credential password --- app/DoctrineMigrations/Version20170501115751.php | 2 +- app/config/wallabag.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20170501115751.php b/app/DoctrineMigrations/Version20170501115751.php index 846a87b5..2597f1ff 100644 --- a/app/DoctrineMigrations/Version20170501115751.php +++ b/app/DoctrineMigrations/Version20170501115751.php @@ -39,7 +39,7 @@ class Version20170501115751 extends AbstractMigration implements ContainerAwareI $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('password', 'text'); $table->addColumn('createdAt', 'datetime'); $table->addIndex(['user_id'], 'idx_user'); $table->setPrimaryKey(['id']); diff --git a/app/config/wallabag.yml b/app/config/wallabag.yml index 51b7e4e3..b45934e4 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 -- cgit v1.2.3 From bead8b42da4f17238dc0d5e0f90184b224ec5df7 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Wed, 14 Jun 2017 15:02:34 +0200 Subject: Fix reviews Encrypt username too Redirect to list after saving credentials Fix typos Signed-off-by: Thomas Citharel --- app/DoctrineMigrations/Version20170501115751.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app') diff --git a/app/DoctrineMigrations/Version20170501115751.php b/app/DoctrineMigrations/Version20170501115751.php index 2597f1ff..7f068eb8 100644 --- a/app/DoctrineMigrations/Version20170501115751.php +++ b/app/DoctrineMigrations/Version20170501115751.php @@ -38,7 +38,7 @@ class Version20170501115751 extends AbstractMigration implements ContainerAwareI $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('username', 'text'); $table->addColumn('password', 'text'); $table->addColumn('createdAt', 'datetime'); $table->addIndex(['user_id'], 'idx_user'); -- cgit v1.2.3