mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 19:11:07 +00:00
implement FosUser
This commit is contained in:
parent
9c08a891f9
commit
a1691859ca
14 changed files with 138 additions and 307 deletions
|
@ -17,6 +17,7 @@ class AppKernel extends Kernel
|
||||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||||
new FOS\RestBundle\FOSRestBundle(),
|
new FOS\RestBundle\FOSRestBundle(),
|
||||||
|
new FOS\UserBundle\FOSUserBundle(),
|
||||||
new JMS\SerializerBundle\JMSSerializerBundle(),
|
new JMS\SerializerBundle\JMSSerializerBundle(),
|
||||||
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
|
new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
|
||||||
new Nelmio\CorsBundle\NelmioCorsBundle(),
|
new Nelmio\CorsBundle\NelmioCorsBundle(),
|
||||||
|
|
|
@ -152,3 +152,8 @@ liip_theme:
|
||||||
# bundle_resource_dir:
|
# bundle_resource_dir:
|
||||||
# - %%dir%%/views/themes/%%current_theme%%/%%bundle_name%%/%%template%%
|
# - %%dir%%/views/themes/%%current_theme%%/%%bundle_name%%/%%template%%
|
||||||
# - %%dir%%/views/%%bundle_name%%/%%override_path%%
|
# - %%dir%%/views/%%bundle_name%%/%%override_path%%
|
||||||
|
|
||||||
|
fos_user:
|
||||||
|
db_driver: orm
|
||||||
|
firewall_name: main
|
||||||
|
user_class: Wallabag\CoreBundle\Entity\User
|
||||||
|
|
|
@ -12,6 +12,8 @@ security:
|
||||||
providers:
|
providers:
|
||||||
administrators:
|
administrators:
|
||||||
entity: { class: WallabagCoreBundle:User, property: username }
|
entity: { class: WallabagCoreBundle:User, property: username }
|
||||||
|
fos_userbundle:
|
||||||
|
id: fos_user.user_provider.username
|
||||||
|
|
||||||
# the main part of the security, where you can set up firewalls
|
# the main part of the security, where you can set up firewalls
|
||||||
# for specific sections of your app
|
# for specific sections of your app
|
||||||
|
@ -27,30 +29,11 @@ security:
|
||||||
|
|
||||||
secured_area:
|
secured_area:
|
||||||
pattern: ^/
|
pattern: ^/
|
||||||
anonymous: ~
|
|
||||||
form_login:
|
form_login:
|
||||||
login_path: /login
|
provider: fos_userbundle
|
||||||
|
csrf_provider: security.csrf.token_manager
|
||||||
use_forward: false
|
|
||||||
|
|
||||||
check_path: /login_check
|
|
||||||
|
|
||||||
post_only: true
|
|
||||||
|
|
||||||
always_use_default_target_path: false
|
|
||||||
default_target_path: /
|
|
||||||
target_path_parameter: _target_path
|
|
||||||
use_referer: true
|
|
||||||
|
|
||||||
failure_path: null
|
|
||||||
failure_forward: false
|
|
||||||
|
|
||||||
username_parameter: _username
|
|
||||||
password_parameter: _password
|
|
||||||
|
|
||||||
csrf_parameter: _csrf_token
|
|
||||||
intention: authenticate
|
|
||||||
|
|
||||||
|
anonymous: true
|
||||||
remember_me:
|
remember_me:
|
||||||
key: "%secret%"
|
key: "%secret%"
|
||||||
lifetime: 31536000
|
lifetime: 31536000
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../vendor/umpirsky/twig-gettext-extractor/twig-gettext-extractor
|
|
|
@ -52,7 +52,8 @@
|
||||||
"liip/theme-bundle": "~1.1.3",
|
"liip/theme-bundle": "~1.1.3",
|
||||||
"pagerfanta/pagerfanta": "~1.0.3",
|
"pagerfanta/pagerfanta": "~1.0.3",
|
||||||
"lexik/form-filter-bundle": "~4.0",
|
"lexik/form-filter-bundle": "~4.0",
|
||||||
"j0k3r/graby": "~1.0"
|
"j0k3r/graby": "~1.0",
|
||||||
|
"friendsofsymfony/user-bundle": "dev-master"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"doctrine/doctrine-fixtures-bundle": "~2.2.0",
|
"doctrine/doctrine-fixtures-bundle": "~2.2.0",
|
||||||
|
|
144
composer.lock
generated
144
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"hash": "f5520667cebcae76568ff448172854bd",
|
"hash": "d457fa385420eb29a177ac38eac977c3",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "doctrine/annotations",
|
"name": "doctrine/annotations",
|
||||||
|
@ -693,16 +693,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "doctrine/orm",
|
"name": "doctrine/orm",
|
||||||
"version": "v2.5.1",
|
"version": "v2.5.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/doctrine/doctrine2.git",
|
"url": "https://github.com/doctrine/doctrine2.git",
|
||||||
"reference": "e6a83bedbe67579cb0bfb688e982e617943a2945"
|
"reference": "aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/doctrine/doctrine2/zipball/e6a83bedbe67579cb0bfb688e982e617943a2945",
|
"url": "https://api.github.com/repos/doctrine/doctrine2/zipball/aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe",
|
||||||
"reference": "e6a83bedbe67579cb0bfb688e982e617943a2945",
|
"reference": "aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -766,7 +766,7 @@
|
||||||
"database",
|
"database",
|
||||||
"orm"
|
"orm"
|
||||||
],
|
],
|
||||||
"time": "2015-08-31 12:59:39"
|
"time": "2015-04-02 20:40:18"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ezyang/htmlpurifier",
|
"name": "ezyang/htmlpurifier",
|
||||||
|
@ -942,6 +942,73 @@
|
||||||
],
|
],
|
||||||
"time": "2015-06-16 08:39:26"
|
"time": "2015-06-16 08:39:26"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "friendsofsymfony/user-bundle",
|
||||||
|
"version": "dev-master",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git",
|
||||||
|
"reference": "336d9cd8ba0c5a462b3e70be144a7bef5377b219"
|
||||||
|
},
|
||||||
|
"dist": {
|
||||||
|
"type": "zip",
|
||||||
|
"url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/336d9cd8ba0c5a462b3e70be144a7bef5377b219",
|
||||||
|
"reference": "336d9cd8ba0c5a462b3e70be144a7bef5377b219",
|
||||||
|
"shasum": ""
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"php": ">=5.3.2",
|
||||||
|
"symfony/form": "~2.3",
|
||||||
|
"symfony/framework-bundle": "~2.3",
|
||||||
|
"symfony/security-bundle": "~2.3",
|
||||||
|
"symfony/twig-bundle": "~2.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"doctrine/doctrine-bundle": "~1.3",
|
||||||
|
"swiftmailer/swiftmailer": "~4.3|~5",
|
||||||
|
"symfony/validator": "~2.3",
|
||||||
|
"symfony/yaml": "~2.3",
|
||||||
|
"willdurand/propel-typehintable-behavior": "~1.0"
|
||||||
|
},
|
||||||
|
"suggest": {
|
||||||
|
"willdurand/propel-typehintable-behavior": "Needed when using the propel implementation"
|
||||||
|
},
|
||||||
|
"type": "symfony-bundle",
|
||||||
|
"extra": {
|
||||||
|
"branch-alias": {
|
||||||
|
"dev-master": "2.0.x-dev"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"FOS\\UserBundle\\": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"MIT"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "Christophe Coevoet",
|
||||||
|
"email": "stof@notk.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "FriendsOfSymfony Community",
|
||||||
|
"homepage": "https://github.com/friendsofsymfony/FOSUserBundle/contributors"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Thibault Duplessis",
|
||||||
|
"email": "thibault.duplessis@gmail.com"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Symfony FOSUserBundle",
|
||||||
|
"homepage": "http://friendsofsymfony.github.com",
|
||||||
|
"keywords": [
|
||||||
|
"User management"
|
||||||
|
],
|
||||||
|
"time": "2015-08-14 09:45:59"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "guzzlehttp/guzzle",
|
"name": "guzzlehttp/guzzle",
|
||||||
"version": "5.3.0",
|
"version": "5.3.0",
|
||||||
|
@ -2673,37 +2740,32 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/assetic-bundle",
|
"name": "symfony/assetic-bundle",
|
||||||
"version": "v2.7.0",
|
"version": "v2.6.1",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/AsseticBundle.git",
|
"url": "https://github.com/symfony/AsseticBundle.git",
|
||||||
"reference": "3ae5c8ca3079b6e0033cc9fbfb6500e2bc964da5"
|
"reference": "422b0add2110f0cf9bc7a873a386ea053f4a89f0"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/3ae5c8ca3079b6e0033cc9fbfb6500e2bc964da5",
|
"url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/422b0add2110f0cf9bc7a873a386ea053f4a89f0",
|
||||||
"reference": "3ae5c8ca3079b6e0033cc9fbfb6500e2bc964da5",
|
"reference": "422b0add2110f0cf9bc7a873a386ea053f4a89f0",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"kriswallsmith/assetic": "~1.3",
|
"kriswallsmith/assetic": "~1.2",
|
||||||
"php": ">=5.3.0",
|
"php": ">=5.3.0",
|
||||||
"symfony/console": "~2.3",
|
"symfony/console": "~2.3",
|
||||||
"symfony/dependency-injection": "~2.3",
|
"symfony/dependency-injection": "~2.3",
|
||||||
"symfony/framework-bundle": "~2.3",
|
"symfony/framework-bundle": "~2.3",
|
||||||
"symfony/yaml": "~2.3"
|
"symfony/yaml": "~2.3"
|
||||||
},
|
},
|
||||||
"conflict": {
|
|
||||||
"kriswallsmith/spork": "<=0.2",
|
|
||||||
"twig/twig": "<1.20"
|
|
||||||
},
|
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"kriswallsmith/spork": "~0.3",
|
"kriswallsmith/spork": "~0.2",
|
||||||
"patchwork/jsqueeze": "~1.0",
|
"patchwork/jsqueeze": "~1.0",
|
||||||
"symfony/class-loader": "~2.3",
|
"symfony/class-loader": "~2.3",
|
||||||
"symfony/css-selector": "~2.3",
|
"symfony/css-selector": "~2.3",
|
||||||
"symfony/dom-crawler": "~2.3",
|
"symfony/dom-crawler": "~2.3",
|
||||||
"symfony/phpunit-bridge": "~2.7",
|
|
||||||
"symfony/twig-bundle": "~2.3"
|
"symfony/twig-bundle": "~2.3"
|
||||||
},
|
},
|
||||||
"suggest": {
|
"suggest": {
|
||||||
|
@ -2713,7 +2775,7 @@
|
||||||
"type": "symfony-bundle",
|
"type": "symfony-bundle",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.7-dev"
|
"dev-master": "2.5-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -2739,7 +2801,7 @@
|
||||||
"compression",
|
"compression",
|
||||||
"minification"
|
"minification"
|
||||||
],
|
],
|
||||||
"time": "2015-09-01 00:05:29"
|
"time": "2015-01-27 12:45:16"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/monolog-bundle",
|
"name": "symfony/monolog-bundle",
|
||||||
|
@ -2859,23 +2921,23 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/symfony",
|
"name": "symfony/symfony",
|
||||||
"version": "v2.7.4",
|
"version": "v2.7.3",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/symfony.git",
|
"url": "https://github.com/symfony/symfony.git",
|
||||||
"reference": "1fdf23fe28876844b887b0e1935c9adda43ee645"
|
"reference": "a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/symfony/zipball/1fdf23fe28876844b887b0e1935c9adda43ee645",
|
"url": "https://api.github.com/repos/symfony/symfony/zipball/a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486",
|
||||||
"reference": "1fdf23fe28876844b887b0e1935c9adda43ee645",
|
"reference": "a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"doctrine/common": "~2.3",
|
"doctrine/common": "~2.3",
|
||||||
"php": ">=5.3.9",
|
"php": ">=5.3.9",
|
||||||
"psr/log": "~1.0",
|
"psr/log": "~1.0",
|
||||||
"twig/twig": "~1.20|~2.0"
|
"twig/twig": "~1.18"
|
||||||
},
|
},
|
||||||
"replace": {
|
"replace": {
|
||||||
"symfony/asset": "self.version",
|
"symfony/asset": "self.version",
|
||||||
|
@ -2977,7 +3039,7 @@
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"framework"
|
"framework"
|
||||||
],
|
],
|
||||||
"time": "2015-09-08 14:26:39"
|
"time": "2015-07-31 13:24:45"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "tecnick.com/tcpdf",
|
"name": "tecnick.com/tcpdf",
|
||||||
|
@ -3044,20 +3106,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/extensions",
|
"name": "twig/extensions",
|
||||||
"version": "v1.3.0",
|
"version": "v1.2.0",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/twigphp/Twig-extensions.git",
|
"url": "https://github.com/twigphp/Twig-extensions.git",
|
||||||
"reference": "449e3c8a9ffad7c2479c7864557275a32b037499"
|
"reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/449e3c8a9ffad7c2479c7864557275a32b037499",
|
"url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/8cf4b9fe04077bd54fc73f4fde83347040c3b8cd",
|
||||||
"reference": "449e3c8a9ffad7c2479c7864557275a32b037499",
|
"reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"twig/twig": "~1.20|~2.0"
|
"twig/twig": "~1.12"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"symfony/translation": "~2.3"
|
"symfony/translation": "~2.3"
|
||||||
|
@ -3068,7 +3130,7 @@
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "1.3-dev"
|
"dev-master": "1.2.x-dev"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
@ -3092,7 +3154,7 @@
|
||||||
"i18n",
|
"i18n",
|
||||||
"text"
|
"text"
|
||||||
],
|
],
|
||||||
"time": "2015-08-22 16:38:35"
|
"time": "2014-10-30 14:30:03"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "twig/twig",
|
"name": "twig/twig",
|
||||||
|
@ -3261,7 +3323,7 @@
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "William DURAND",
|
"name": "William Durand",
|
||||||
"email": "william.durand1@gmail.com"
|
"email": "william.durand1@gmail.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -3346,7 +3408,7 @@
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "William DURAND",
|
"name": "William Durand",
|
||||||
"email": "william.durand1@gmail.com"
|
"email": "william.durand1@gmail.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -3828,16 +3890,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit",
|
"name": "phpunit/phpunit",
|
||||||
"version": "4.8.6",
|
"version": "4.8.5",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
"url": "https://github.com/sebastianbergmann/phpunit.git",
|
||||||
"reference": "2246830f4a1a551c67933e4171bf2126dc29d357"
|
"reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357",
|
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b7417edaf28059ea63d86be941e6004dbfcc0cc",
|
||||||
"reference": "2246830f4a1a551c67933e4171bf2126dc29d357",
|
"reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -3896,7 +3958,7 @@
|
||||||
"testing",
|
"testing",
|
||||||
"xunit"
|
"xunit"
|
||||||
],
|
],
|
||||||
"time": "2015-08-24 04:09:38"
|
"time": "2015-08-19 09:20:57"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "phpunit/phpunit-mock-objects",
|
"name": "phpunit/phpunit-mock-objects",
|
||||||
|
@ -4376,7 +4438,9 @@
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "dev",
|
"minimum-stability": "dev",
|
||||||
"stability-flags": [],
|
"stability-flags": {
|
||||||
|
"friendsofsymfony/user-bundle": 20
|
||||||
|
},
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
|
|
|
@ -192,6 +192,7 @@ class InstallCommand extends ContainerAwareCommand
|
||||||
$user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
$user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
||||||
$user->setPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
$user->setPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
|
||||||
$user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', ''));
|
$user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', ''));
|
||||||
|
$user->setEnabled(true);
|
||||||
|
|
||||||
$em->persist($user);
|
$em->persist($user);
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
|
||||||
$userAdmin->setEmail('bigboss@wallabag.org');
|
$userAdmin->setEmail('bigboss@wallabag.org');
|
||||||
$userAdmin->setUsername('admin');
|
$userAdmin->setUsername('admin');
|
||||||
$userAdmin->setPassword('mypassword');
|
$userAdmin->setPassword('mypassword');
|
||||||
|
$userAdmin->setEnabled(true);
|
||||||
|
|
||||||
$manager->persist($userAdmin);
|
$manager->persist($userAdmin);
|
||||||
|
|
||||||
|
@ -29,6 +30,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
|
||||||
$bobUser->setEmail('bobby@wallabag.org');
|
$bobUser->setEmail('bobby@wallabag.org');
|
||||||
$bobUser->setUsername('bob');
|
$bobUser->setUsername('bob');
|
||||||
$bobUser->setPassword('mypassword');
|
$bobUser->setPassword('mypassword');
|
||||||
|
$bobUser->setEnabled(true);
|
||||||
|
|
||||||
$manager->persist($bobUser);
|
$manager->persist($bobUser);
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ use Symfony\Component\Security\Core\User\AdvancedUserInterface;
|
||||||
use Symfony\Component\Validator\Constraints as Assert;
|
use Symfony\Component\Validator\Constraints as Assert;
|
||||||
use JMS\Serializer\Annotation\ExclusionPolicy;
|
use JMS\Serializer\Annotation\ExclusionPolicy;
|
||||||
use JMS\Serializer\Annotation\Expose;
|
use JMS\Serializer\Annotation\Expose;
|
||||||
|
use FOS\UserBundle\Model\User as BaseUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* User.
|
* User.
|
||||||
|
@ -22,7 +23,7 @@ use JMS\Serializer\Annotation\Expose;
|
||||||
* @UniqueEntity("email")
|
* @UniqueEntity("email")
|
||||||
* @UniqueEntity("username")
|
* @UniqueEntity("username")
|
||||||
*/
|
*/
|
||||||
class User implements AdvancedUserInterface, \Serializable
|
class User extends BaseUser implements AdvancedUserInterface, \Serializable
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
|
@ -32,98 +33,47 @@ class User implements AdvancedUserInterface, \Serializable
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
* @ORM\GeneratedValue(strategy="AUTO")
|
* @ORM\GeneratedValue(strategy="AUTO")
|
||||||
*/
|
*/
|
||||||
private $id;
|
protected $id;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @ORM\Column(name="username", type="text")
|
|
||||||
* @Assert\NotBlank()
|
|
||||||
* @Assert\Length(
|
|
||||||
* min = "3",
|
|
||||||
* max = "255"
|
|
||||||
* )
|
|
||||||
*/
|
|
||||||
private $username;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @ORM\Column(type="string", length=32)
|
|
||||||
*/
|
|
||||||
private $salt;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @ORM\Column(name="password", type="text")
|
|
||||||
*/
|
|
||||||
private $password;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="name", type="text", nullable=true)
|
* @ORM\Column(name="name", type="text", nullable=true)
|
||||||
*/
|
*/
|
||||||
private $name;
|
protected $name;
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*
|
|
||||||
* @ORM\Column(name="email", type="text", nullable=false)
|
|
||||||
* @Assert\Email()
|
|
||||||
* @Assert\NotBlank()
|
|
||||||
*/
|
|
||||||
private $email;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="is_active", type="boolean", nullable=false)
|
|
||||||
*/
|
|
||||||
private $isActive = true;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="confirmation_token", type="string", nullable=true)
|
|
||||||
*/
|
|
||||||
private $confirmationToken;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @ORM\Column(name="password_requested_at", type="datetime", nullable=true)
|
|
||||||
*/
|
|
||||||
private $passwordRequestedAt;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var date
|
* @var date
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="created_at", type="datetime")
|
* @ORM\Column(name="created_at", type="datetime")
|
||||||
*/
|
*/
|
||||||
private $createdAt;
|
protected $createdAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var date
|
* @var date
|
||||||
*
|
*
|
||||||
* @ORM\Column(name="updated_at", type="datetime")
|
* @ORM\Column(name="updated_at", type="datetime")
|
||||||
*/
|
*/
|
||||||
private $updatedAt;
|
protected $updatedAt;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"})
|
* @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"})
|
||||||
*/
|
*/
|
||||||
private $entries;
|
protected $entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToOne(targetEntity="Config", mappedBy="user")
|
* @ORM\OneToOne(targetEntity="Config", mappedBy="user")
|
||||||
*/
|
*/
|
||||||
private $config;
|
protected $config;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"})
|
* @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"})
|
||||||
*/
|
*/
|
||||||
private $tags;
|
protected $tags;
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
$this->isActive = true;
|
parent::__construct();
|
||||||
$this->salt = md5(uniqid(null, true));
|
|
||||||
$this->entries = new ArrayCollection();
|
$this->entries = new ArrayCollection();
|
||||||
$this->tags = new ArrayCollection();
|
$this->tags = new ArrayCollection();
|
||||||
}
|
}
|
||||||
|
@ -141,56 +91,6 @@ class User implements AdvancedUserInterface, \Serializable
|
||||||
$this->updatedAt = new \DateTime();
|
$this->updatedAt = new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get id.
|
|
||||||
*
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getId()
|
|
||||||
{
|
|
||||||
return $this->id;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set username.
|
|
||||||
*
|
|
||||||
* @param string $username
|
|
||||||
*
|
|
||||||
* @return User
|
|
||||||
*/
|
|
||||||
public function setUsername($username)
|
|
||||||
{
|
|
||||||
$this->username = $username;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get username.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getUsername()
|
|
||||||
{
|
|
||||||
return $this->username;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getSalt()
|
|
||||||
{
|
|
||||||
return $this->salt;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function getRoles()
|
|
||||||
{
|
|
||||||
return array('ROLE_USER');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set password.
|
* Set password.
|
||||||
*
|
*
|
||||||
|
@ -209,16 +109,6 @@ class User implements AdvancedUserInterface, \Serializable
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get password.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getPassword()
|
|
||||||
{
|
|
||||||
return $this->password;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set name.
|
* Set name.
|
||||||
*
|
*
|
||||||
|
@ -243,30 +133,6 @@ class User implements AdvancedUserInterface, \Serializable
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set email.
|
|
||||||
*
|
|
||||||
* @param string $email
|
|
||||||
*
|
|
||||||
* @return User
|
|
||||||
*/
|
|
||||||
public function setEmail($email)
|
|
||||||
{
|
|
||||||
$this->email = $email;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get email.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getEmail()
|
|
||||||
{
|
|
||||||
return $this->email;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
@ -322,56 +188,12 @@ class User implements AdvancedUserInterface, \Serializable
|
||||||
{
|
{
|
||||||
return $this->tags;
|
return $this->tags;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* {@inheritdoc}
|
|
||||||
*/
|
|
||||||
public function eraseCredentials()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \Serializable::serialize()
|
|
||||||
*/
|
|
||||||
public function serialize()
|
|
||||||
{
|
|
||||||
return serialize(array(
|
|
||||||
$this->id,
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see \Serializable::unserialize()
|
|
||||||
*/
|
|
||||||
public function unserialize($serialized)
|
|
||||||
{
|
|
||||||
list(
|
|
||||||
$this->id) = unserialize($serialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isEqualTo(UserInterface $user)
|
public function isEqualTo(UserInterface $user)
|
||||||
{
|
{
|
||||||
return $this->username === $user->getUsername();
|
return $this->username === $user->getUsername();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isAccountNonExpired()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isAccountNonLocked()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isCredentialsNonExpired()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function isEnabled()
|
|
||||||
{
|
|
||||||
return $this->isActive;
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Set config.
|
* Set config.
|
||||||
*
|
*
|
||||||
|
@ -395,52 +217,4 @@ class User implements AdvancedUserInterface, \Serializable
|
||||||
{
|
{
|
||||||
return $this->config;
|
return $this->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set confirmationToken.
|
|
||||||
*
|
|
||||||
* @param string $confirmationToken
|
|
||||||
*
|
|
||||||
* @return User
|
|
||||||
*/
|
|
||||||
public function setConfirmationToken($confirmationToken)
|
|
||||||
{
|
|
||||||
$this->confirmationToken = $confirmationToken;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get confirmationToken.
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getConfirmationToken()
|
|
||||||
{
|
|
||||||
return $this->confirmationToken;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set passwordRequestedAt.
|
|
||||||
*
|
|
||||||
* @param \DateTime $passwordRequestedAt
|
|
||||||
*
|
|
||||||
* @return User
|
|
||||||
*/
|
|
||||||
public function setPasswordRequestedAt($passwordRequestedAt)
|
|
||||||
{
|
|
||||||
$this->passwordRequestedAt = $passwordRequestedAt;
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get passwordRequestedAt.
|
|
||||||
*
|
|
||||||
* @return \DateTime
|
|
||||||
*/
|
|
||||||
public function getPasswordRequestedAt()
|
|
||||||
{
|
|
||||||
return $this->passwordRequestedAt;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mts txtcenter">
|
<div class="row mts txtcenter">
|
||||||
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
|
||||||
<button type="submit">Login</button>
|
<button type="submit">Login</button>
|
||||||
<a href="{{ path('forgot_password') }}" class="small">Forgot your password?</a>
|
<a href="{{ path('forgot_password') }}" class="small">Forgot your password?</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -58,7 +58,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
||||||
<!-- Filters -->
|
<!-- Filters -->
|
||||||
<div id="filters" class="side-nav fixed right-aligned">
|
<div id="filters" class="side-nav fixed right-aligned">
|
||||||
<form action="{{ path('all') }}">
|
<form action="{{ path('all') }}">
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="card-action">
|
<div class="card-action">
|
||||||
|
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
|
||||||
<button class="btn waves-effect waves-light" type="submit" name="send">
|
<button class="btn waves-effect waves-light" type="submit" name="send">
|
||||||
{% trans %}Login{% endtrans %}
|
{% trans %}Login{% endtrans %}
|
||||||
<i class="mdi-content-send right"></i>
|
<i class="mdi-content-send right"></i>
|
||||||
|
|
|
@ -75,7 +75,7 @@ class InstallCommandTest extends WallabagCoreTestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
$dialog->expects($this->any())
|
$dialog->expects($this->any())
|
||||||
->method('ask')
|
->method('ask')
|
||||||
->will($this->returnValue('test'));
|
->will($this->returnValue('test2'));
|
||||||
$dialog->expects($this->any())
|
$dialog->expects($this->any())
|
||||||
->method('askConfirmation')
|
->method('askConfirmation')
|
||||||
->will($this->returnValue(true));
|
->will($this->returnValue(true));
|
||||||
|
|
|
@ -266,7 +266,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'new_user[username]' => 'ad',
|
'new_user[username]' => 'ad',
|
||||||
'new_user[password]' => '',
|
'new_user[password]' => 'mypassword',
|
||||||
'new_user[email]' => '',
|
'new_user[email]' => '',
|
||||||
),
|
),
|
||||||
'This value is too short.',
|
'This value is too short.',
|
||||||
|
@ -274,7 +274,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'new_user[username]' => 'wallace',
|
'new_user[username]' => 'wallace',
|
||||||
'new_user[password]' => '',
|
'new_user[password]' => 'mypassword',
|
||||||
'new_user[email]' => 'test',
|
'new_user[email]' => 'test',
|
||||||
),
|
),
|
||||||
'This value is not a valid email address.',
|
'This value is not a valid email address.',
|
||||||
|
|
Loading…
Reference in a new issue