aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-18 11:08:45 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-09-11 20:32:37 +0200
commita1691859ca0cb4c1b360c34b05aa74bdba9e582a (patch)
tree47ef239ea8f452ba4de71f76c9cab607a4dadf8c
parent9c08a891f9bb90bc3f23a575a734283c1ee00ba1 (diff)
downloadwallabag-a1691859ca0cb4c1b360c34b05aa74bdba9e582a.tar.gz
wallabag-a1691859ca0cb4c1b360c34b05aa74bdba9e582a.tar.zst
wallabag-a1691859ca0cb4c1b360c34b05aa74bdba9e582a.zip
implement FosUser
-rw-r--r--app/AppKernel.php1
-rw-r--r--app/config/config.yml5
-rw-r--r--app/config/security.yml29
l---------bin/twig-gettext-extractor1
-rw-r--r--composer.json3
-rw-r--r--composer.lock144
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php1
-rw-r--r--src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php2
-rw-r--r--src/Wallabag/CoreBundle/Entity/User.php250
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig1
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php2
-rw-r--r--src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php4
14 files changed, 138 insertions, 307 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 00206ddf..08e14b8f 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -17,6 +17,7 @@ class AppKernel extends Kernel
17 new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), 17 new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
18 new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(), 18 new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
19 new FOS\RestBundle\FOSRestBundle(), 19 new FOS\RestBundle\FOSRestBundle(),
20 new FOS\UserBundle\FOSUserBundle(),
20 new JMS\SerializerBundle\JMSSerializerBundle(), 21 new JMS\SerializerBundle\JMSSerializerBundle(),
21 new Nelmio\ApiDocBundle\NelmioApiDocBundle(), 22 new Nelmio\ApiDocBundle\NelmioApiDocBundle(),
22 new Nelmio\CorsBundle\NelmioCorsBundle(), 23 new Nelmio\CorsBundle\NelmioCorsBundle(),
diff --git a/app/config/config.yml b/app/config/config.yml
index efc815b8..f623ab23 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -152,3 +152,8 @@ liip_theme:
152 # bundle_resource_dir: 152 # bundle_resource_dir:
153 # - %%dir%%/views/themes/%%current_theme%%/%%bundle_name%%/%%template%% 153 # - %%dir%%/views/themes/%%current_theme%%/%%bundle_name%%/%%template%%
154 # - %%dir%%/views/%%bundle_name%%/%%override_path%% 154 # - %%dir%%/views/%%bundle_name%%/%%override_path%%
155
156fos_user:
157 db_driver: orm
158 firewall_name: main
159 user_class: Wallabag\CoreBundle\Entity\User
diff --git a/app/config/security.yml b/app/config/security.yml
index b9c4cbef..98846656 100644
--- a/app/config/security.yml
+++ b/app/config/security.yml
@@ -12,6 +12,8 @@ security:
12 providers: 12 providers:
13 administrators: 13 administrators:
14 entity: { class: WallabagCoreBundle:User, property: username } 14 entity: { class: WallabagCoreBundle:User, property: username }
15 fos_userbundle:
16 id: fos_user.user_provider.username
15 17
16 # the main part of the security, where you can set up firewalls 18 # the main part of the security, where you can set up firewalls
17 # for specific sections of your app 19 # for specific sections of your app
@@ -26,31 +28,12 @@ security:
26 anonymous: ~ 28 anonymous: ~
27 29
28 secured_area: 30 secured_area:
29 pattern: ^/ 31 pattern: ^/
30 anonymous: ~
31 form_login: 32 form_login:
32 login_path: /login 33 provider: fos_userbundle
33 34 csrf_provider: security.csrf.token_manager
34 use_forward: false
35
36 check_path: /login_check
37
38 post_only: true
39
40 always_use_default_target_path: false
41 default_target_path: /
42 target_path_parameter: _target_path
43 use_referer: true
44
45 failure_path: null
46 failure_forward: false
47
48 username_parameter: _username
49 password_parameter: _password
50
51 csrf_parameter: _csrf_token
52 intention: authenticate
53 35
36 anonymous: true
54 remember_me: 37 remember_me:
55 key: "%secret%" 38 key: "%secret%"
56 lifetime: 31536000 39 lifetime: 31536000
diff --git a/bin/twig-gettext-extractor b/bin/twig-gettext-extractor
deleted file mode 120000
index 0a8959b0..00000000
--- a/bin/twig-gettext-extractor
+++ /dev/null
@@ -1 +0,0 @@
1../vendor/umpirsky/twig-gettext-extractor/twig-gettext-extractor \ No newline at end of file
diff --git a/composer.json b/composer.json
index 20bb5537..82fe61bd 100644
--- a/composer.json
+++ b/composer.json
@@ -52,7 +52,8 @@
52 "liip/theme-bundle": "~1.1.3", 52 "liip/theme-bundle": "~1.1.3",
53 "pagerfanta/pagerfanta": "~1.0.3", 53 "pagerfanta/pagerfanta": "~1.0.3",
54 "lexik/form-filter-bundle": "~4.0", 54 "lexik/form-filter-bundle": "~4.0",
55 "j0k3r/graby": "~1.0" 55 "j0k3r/graby": "~1.0",
56 "friendsofsymfony/user-bundle": "dev-master"
56 }, 57 },
57 "require-dev": { 58 "require-dev": {
58 "doctrine/doctrine-fixtures-bundle": "~2.2.0", 59 "doctrine/doctrine-fixtures-bundle": "~2.2.0",
diff --git a/composer.lock b/composer.lock
index 35d8b978..7dbb3cd8 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 "This file is @generated automatically" 5 "This file is @generated automatically"
6 ], 6 ],
7 "hash": "f5520667cebcae76568ff448172854bd", 7 "hash": "d457fa385420eb29a177ac38eac977c3",
8 "packages": [ 8 "packages": [
9 { 9 {
10 "name": "doctrine/annotations", 10 "name": "doctrine/annotations",
@@ -693,16 +693,16 @@
693 }, 693 },
694 { 694 {
695 "name": "doctrine/orm", 695 "name": "doctrine/orm",
696 "version": "v2.5.1", 696 "version": "v2.5.0",
697 "source": { 697 "source": {
698 "type": "git", 698 "type": "git",
699 "url": "https://github.com/doctrine/doctrine2.git", 699 "url": "https://github.com/doctrine/doctrine2.git",
700 "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945" 700 "reference": "aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe"
701 }, 701 },
702 "dist": { 702 "dist": {
703 "type": "zip", 703 "type": "zip",
704 "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/e6a83bedbe67579cb0bfb688e982e617943a2945", 704 "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe",
705 "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945", 705 "reference": "aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe",
706 "shasum": "" 706 "shasum": ""
707 }, 707 },
708 "require": { 708 "require": {
@@ -766,7 +766,7 @@
766 "database", 766 "database",
767 "orm" 767 "orm"
768 ], 768 ],
769 "time": "2015-08-31 12:59:39" 769 "time": "2015-04-02 20:40:18"
770 }, 770 },
771 { 771 {
772 "name": "ezyang/htmlpurifier", 772 "name": "ezyang/htmlpurifier",
@@ -943,6 +943,73 @@
943 "time": "2015-06-16 08:39:26" 943 "time": "2015-06-16 08:39:26"
944 }, 944 },
945 { 945 {
946 "name": "friendsofsymfony/user-bundle",
947 "version": "dev-master",
948 "source": {
949 "type": "git",
950 "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git",
951 "reference": "336d9cd8ba0c5a462b3e70be144a7bef5377b219"
952 },
953 "dist": {
954 "type": "zip",
955 "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/336d9cd8ba0c5a462b3e70be144a7bef5377b219",
956 "reference": "336d9cd8ba0c5a462b3e70be144a7bef5377b219",
957 "shasum": ""
958 },
959 "require": {
960 "php": ">=5.3.2",
961 "symfony/form": "~2.3",
962 "symfony/framework-bundle": "~2.3",
963 "symfony/security-bundle": "~2.3",
964 "symfony/twig-bundle": "~2.3"
965 },
966 "require-dev": {
967 "doctrine/doctrine-bundle": "~1.3",
968 "swiftmailer/swiftmailer": "~4.3|~5",
969 "symfony/validator": "~2.3",
970 "symfony/yaml": "~2.3",
971 "willdurand/propel-typehintable-behavior": "~1.0"
972 },
973 "suggest": {
974 "willdurand/propel-typehintable-behavior": "Needed when using the propel implementation"
975 },
976 "type": "symfony-bundle",
977 "extra": {
978 "branch-alias": {
979 "dev-master": "2.0.x-dev"
980 }
981 },
982 "autoload": {
983 "psr-4": {
984 "FOS\\UserBundle\\": ""
985 }
986 },
987 "notification-url": "https://packagist.org/downloads/",
988 "license": [
989 "MIT"
990 ],
991 "authors": [
992 {
993 "name": "Christophe Coevoet",
994 "email": "stof@notk.org"
995 },
996 {
997 "name": "FriendsOfSymfony Community",
998 "homepage": "https://github.com/friendsofsymfony/FOSUserBundle/contributors"
999 },
1000 {
1001 "name": "Thibault Duplessis",
1002 "email": "thibault.duplessis@gmail.com"
1003 }
1004 ],
1005 "description": "Symfony FOSUserBundle",
1006 "homepage": "http://friendsofsymfony.github.com",
1007 "keywords": [
1008 "User management"
1009 ],
1010 "time": "2015-08-14 09:45:59"
1011 },
1012 {
946 "name": "guzzlehttp/guzzle", 1013 "name": "guzzlehttp/guzzle",
947 "version": "5.3.0", 1014 "version": "5.3.0",
948 "source": { 1015 "source": {
@@ -2673,37 +2740,32 @@
2673 }, 2740 },
2674 { 2741 {
2675 "name": "symfony/assetic-bundle", 2742 "name": "symfony/assetic-bundle",
2676 "version": "v2.7.0", 2743 "version": "v2.6.1",
2677 "source": { 2744 "source": {
2678 "type": "git", 2745 "type": "git",
2679 "url": "https://github.com/symfony/AsseticBundle.git", 2746 "url": "https://github.com/symfony/AsseticBundle.git",
2680 "reference": "3ae5c8ca3079b6e0033cc9fbfb6500e2bc964da5" 2747 "reference": "422b0add2110f0cf9bc7a873a386ea053f4a89f0"
2681 }, 2748 },
2682 "dist": { 2749 "dist": {
2683 "type": "zip", 2750 "type": "zip",
2684 "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/3ae5c8ca3079b6e0033cc9fbfb6500e2bc964da5", 2751 "url": "https://api.github.com/repos/symfony/AsseticBundle/zipball/422b0add2110f0cf9bc7a873a386ea053f4a89f0",
2685 "reference": "3ae5c8ca3079b6e0033cc9fbfb6500e2bc964da5", 2752 "reference": "422b0add2110f0cf9bc7a873a386ea053f4a89f0",
2686 "shasum": "" 2753 "shasum": ""
2687 }, 2754 },
2688 "require": { 2755 "require": {
2689 "kriswallsmith/assetic": "~1.3", 2756 "kriswallsmith/assetic": "~1.2",
2690 "php": ">=5.3.0", 2757 "php": ">=5.3.0",
2691 "symfony/console": "~2.3", 2758 "symfony/console": "~2.3",
2692 "symfony/dependency-injection": "~2.3", 2759 "symfony/dependency-injection": "~2.3",
2693 "symfony/framework-bundle": "~2.3", 2760 "symfony/framework-bundle": "~2.3",
2694 "symfony/yaml": "~2.3" 2761 "symfony/yaml": "~2.3"
2695 }, 2762 },
2696 "conflict": {
2697 "kriswallsmith/spork": "<=0.2",
2698 "twig/twig": "<1.20"
2699 },
2700 "require-dev": { 2763 "require-dev": {
2701 "kriswallsmith/spork": "~0.3", 2764 "kriswallsmith/spork": "~0.2",
2702 "patchwork/jsqueeze": "~1.0", 2765 "patchwork/jsqueeze": "~1.0",
2703 "symfony/class-loader": "~2.3", 2766 "symfony/class-loader": "~2.3",
2704 "symfony/css-selector": "~2.3", 2767 "symfony/css-selector": "~2.3",
2705 "symfony/dom-crawler": "~2.3", 2768 "symfony/dom-crawler": "~2.3",
2706 "symfony/phpunit-bridge": "~2.7",
2707 "symfony/twig-bundle": "~2.3" 2769 "symfony/twig-bundle": "~2.3"
2708 }, 2770 },
2709 "suggest": { 2771 "suggest": {
@@ -2713,7 +2775,7 @@
2713 "type": "symfony-bundle", 2775 "type": "symfony-bundle",
2714 "extra": { 2776 "extra": {
2715 "branch-alias": { 2777 "branch-alias": {
2716 "dev-master": "2.7-dev" 2778 "dev-master": "2.5-dev"
2717 } 2779 }
2718 }, 2780 },
2719 "autoload": { 2781 "autoload": {
@@ -2739,7 +2801,7 @@
2739 "compression", 2801 "compression",
2740 "minification" 2802 "minification"
2741 ], 2803 ],
2742 "time": "2015-09-01 00:05:29" 2804 "time": "2015-01-27 12:45:16"
2743 }, 2805 },
2744 { 2806 {
2745 "name": "symfony/monolog-bundle", 2807 "name": "symfony/monolog-bundle",
@@ -2859,23 +2921,23 @@
2859 }, 2921 },
2860 { 2922 {
2861 "name": "symfony/symfony", 2923 "name": "symfony/symfony",
2862 "version": "v2.7.4", 2924 "version": "v2.7.3",
2863 "source": { 2925 "source": {
2864 "type": "git", 2926 "type": "git",
2865 "url": "https://github.com/symfony/symfony.git", 2927 "url": "https://github.com/symfony/symfony.git",
2866 "reference": "1fdf23fe28876844b887b0e1935c9adda43ee645" 2928 "reference": "a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486"
2867 }, 2929 },
2868 "dist": { 2930 "dist": {
2869 "type": "zip", 2931 "type": "zip",
2870 "url": "https://api.github.com/repos/symfony/symfony/zipball/1fdf23fe28876844b887b0e1935c9adda43ee645", 2932 "url": "https://api.github.com/repos/symfony/symfony/zipball/a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486",
2871 "reference": "1fdf23fe28876844b887b0e1935c9adda43ee645", 2933 "reference": "a9af4708b4bb650c4897e9b8dfbfbdb2ea5f0486",
2872 "shasum": "" 2934 "shasum": ""
2873 }, 2935 },
2874 "require": { 2936 "require": {
2875 "doctrine/common": "~2.3", 2937 "doctrine/common": "~2.3",
2876 "php": ">=5.3.9", 2938 "php": ">=5.3.9",
2877 "psr/log": "~1.0", 2939 "psr/log": "~1.0",
2878 "twig/twig": "~1.20|~2.0" 2940 "twig/twig": "~1.18"
2879 }, 2941 },
2880 "replace": { 2942 "replace": {
2881 "symfony/asset": "self.version", 2943 "symfony/asset": "self.version",
@@ -2977,7 +3039,7 @@
2977 "keywords": [ 3039 "keywords": [
2978 "framework" 3040 "framework"
2979 ], 3041 ],
2980 "time": "2015-09-08 14:26:39" 3042 "time": "2015-07-31 13:24:45"
2981 }, 3043 },
2982 { 3044 {
2983 "name": "tecnick.com/tcpdf", 3045 "name": "tecnick.com/tcpdf",
@@ -3044,20 +3106,20 @@
3044 }, 3106 },
3045 { 3107 {
3046 "name": "twig/extensions", 3108 "name": "twig/extensions",
3047 "version": "v1.3.0", 3109 "version": "v1.2.0",
3048 "source": { 3110 "source": {
3049 "type": "git", 3111 "type": "git",
3050 "url": "https://github.com/twigphp/Twig-extensions.git", 3112 "url": "https://github.com/twigphp/Twig-extensions.git",
3051 "reference": "449e3c8a9ffad7c2479c7864557275a32b037499" 3113 "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd"
3052 }, 3114 },
3053 "dist": { 3115 "dist": {
3054 "type": "zip", 3116 "type": "zip",
3055 "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/449e3c8a9ffad7c2479c7864557275a32b037499", 3117 "url": "https://api.github.com/repos/twigphp/Twig-extensions/zipball/8cf4b9fe04077bd54fc73f4fde83347040c3b8cd",
3056 "reference": "449e3c8a9ffad7c2479c7864557275a32b037499", 3118 "reference": "8cf4b9fe04077bd54fc73f4fde83347040c3b8cd",
3057 "shasum": "" 3119 "shasum": ""
3058 }, 3120 },
3059 "require": { 3121 "require": {
3060 "twig/twig": "~1.20|~2.0" 3122 "twig/twig": "~1.12"
3061 }, 3123 },
3062 "require-dev": { 3124 "require-dev": {
3063 "symfony/translation": "~2.3" 3125 "symfony/translation": "~2.3"
@@ -3068,7 +3130,7 @@
3068 "type": "library", 3130 "type": "library",
3069 "extra": { 3131 "extra": {
3070 "branch-alias": { 3132 "branch-alias": {
3071 "dev-master": "1.3-dev" 3133 "dev-master": "1.2.x-dev"
3072 } 3134 }
3073 }, 3135 },
3074 "autoload": { 3136 "autoload": {
@@ -3092,7 +3154,7 @@
3092 "i18n", 3154 "i18n",
3093 "text" 3155 "text"
3094 ], 3156 ],
3095 "time": "2015-08-22 16:38:35" 3157 "time": "2014-10-30 14:30:03"
3096 }, 3158 },
3097 { 3159 {
3098 "name": "twig/twig", 3160 "name": "twig/twig",
@@ -3261,7 +3323,7 @@
3261 ], 3323 ],
3262 "authors": [ 3324 "authors": [
3263 { 3325 {
3264 "name": "William DURAND", 3326 "name": "William Durand",
3265 "email": "william.durand1@gmail.com" 3327 "email": "william.durand1@gmail.com"
3266 } 3328 }
3267 ], 3329 ],
@@ -3346,7 +3408,7 @@
3346 ], 3408 ],
3347 "authors": [ 3409 "authors": [
3348 { 3410 {
3349 "name": "William DURAND", 3411 "name": "William Durand",
3350 "email": "william.durand1@gmail.com" 3412 "email": "william.durand1@gmail.com"
3351 } 3413 }
3352 ], 3414 ],
@@ -3828,16 +3890,16 @@
3828 }, 3890 },
3829 { 3891 {
3830 "name": "phpunit/phpunit", 3892 "name": "phpunit/phpunit",
3831 "version": "4.8.6", 3893 "version": "4.8.5",
3832 "source": { 3894 "source": {
3833 "type": "git", 3895 "type": "git",
3834 "url": "https://github.com/sebastianbergmann/phpunit.git", 3896 "url": "https://github.com/sebastianbergmann/phpunit.git",
3835 "reference": "2246830f4a1a551c67933e4171bf2126dc29d357" 3897 "reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc"
3836 }, 3898 },
3837 "dist": { 3899 "dist": {
3838 "type": "zip", 3900 "type": "zip",
3839 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357", 3901 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9b7417edaf28059ea63d86be941e6004dbfcc0cc",
3840 "reference": "2246830f4a1a551c67933e4171bf2126dc29d357", 3902 "reference": "9b7417edaf28059ea63d86be941e6004dbfcc0cc",
3841 "shasum": "" 3903 "shasum": ""
3842 }, 3904 },
3843 "require": { 3905 "require": {
@@ -3896,7 +3958,7 @@
3896 "testing", 3958 "testing",
3897 "xunit" 3959 "xunit"
3898 ], 3960 ],
3899 "time": "2015-08-24 04:09:38" 3961 "time": "2015-08-19 09:20:57"
3900 }, 3962 },
3901 { 3963 {
3902 "name": "phpunit/phpunit-mock-objects", 3964 "name": "phpunit/phpunit-mock-objects",
@@ -4376,7 +4438,9 @@
4376 ], 4438 ],
4377 "aliases": [], 4439 "aliases": [],
4378 "minimum-stability": "dev", 4440 "minimum-stability": "dev",
4379 "stability-flags": [], 4441 "stability-flags": {
4442 "friendsofsymfony/user-bundle": 20
4443 },
4380 "prefer-stable": true, 4444 "prefer-stable": true,
4381 "prefer-lowest": false, 4445 "prefer-lowest": false,
4382 "platform": { 4446 "platform": {
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 491c67f9..29d91109 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -192,6 +192,7 @@ class InstallCommand extends ContainerAwareCommand
192 $user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 192 $user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
193 $user->setPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 193 $user->setPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag'));
194 $user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', '')); 194 $user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', ''));
195 $user->setEnabled(true);
195 196
196 $em->persist($user); 197 $em->persist($user);
197 198
diff --git a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php
index 1c7f9dfa..4ef53329 100644
--- a/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php
+++ b/src/Wallabag/CoreBundle/DataFixtures/ORM/LoadUserData.php
@@ -19,6 +19,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
19 $userAdmin->setEmail('bigboss@wallabag.org'); 19 $userAdmin->setEmail('bigboss@wallabag.org');
20 $userAdmin->setUsername('admin'); 20 $userAdmin->setUsername('admin');
21 $userAdmin->setPassword('mypassword'); 21 $userAdmin->setPassword('mypassword');
22 $userAdmin->setEnabled(true);
22 23
23 $manager->persist($userAdmin); 24 $manager->persist($userAdmin);
24 25
@@ -29,6 +30,7 @@ class LoadUserData extends AbstractFixture implements OrderedFixtureInterface
29 $bobUser->setEmail('bobby@wallabag.org'); 30 $bobUser->setEmail('bobby@wallabag.org');
30 $bobUser->setUsername('bob'); 31 $bobUser->setUsername('bob');
31 $bobUser->setPassword('mypassword'); 32 $bobUser->setPassword('mypassword');
33 $bobUser->setEnabled(true);
32 34
33 $manager->persist($bobUser); 35 $manager->persist($bobUser);
34 36
diff --git a/src/Wallabag/CoreBundle/Entity/User.php b/src/Wallabag/CoreBundle/Entity/User.php
index 510a1594..eeae331e 100644
--- a/src/Wallabag/CoreBundle/Entity/User.php
+++ b/src/Wallabag/CoreBundle/Entity/User.php
@@ -10,6 +10,7 @@ use Symfony\Component\Security\Core\User\AdvancedUserInterface;
10use Symfony\Component\Validator\Constraints as Assert; 10use Symfony\Component\Validator\Constraints as Assert;
11use JMS\Serializer\Annotation\ExclusionPolicy; 11use JMS\Serializer\Annotation\ExclusionPolicy;
12use JMS\Serializer\Annotation\Expose; 12use JMS\Serializer\Annotation\Expose;
13use FOS\UserBundle\Model\User as BaseUser;
13 14
14/** 15/**
15 * User. 16 * User.
@@ -22,7 +23,7 @@ use JMS\Serializer\Annotation\Expose;
22 * @UniqueEntity("email") 23 * @UniqueEntity("email")
23 * @UniqueEntity("username") 24 * @UniqueEntity("username")
24 */ 25 */
25class User implements AdvancedUserInterface, \Serializable 26class User extends BaseUser implements AdvancedUserInterface, \Serializable
26{ 27{
27 /** 28 /**
28 * @var int 29 * @var int
@@ -32,100 +33,49 @@ class User implements AdvancedUserInterface, \Serializable
32 * @ORM\Id 33 * @ORM\Id
33 * @ORM\GeneratedValue(strategy="AUTO") 34 * @ORM\GeneratedValue(strategy="AUTO")
34 */ 35 */
35 private $id; 36 protected $id;
36
37 /**
38 * @var string
39 *
40 * @ORM\Column(name="username", type="text")
41 * @Assert\NotBlank()
42 * @Assert\Length(
43 * min = "3",
44 * max = "255"
45 * )
46 */
47 private $username;
48
49 /**
50 * @var string
51 *
52 * @ORM\Column(type="string", length=32)
53 */
54 private $salt;
55
56 /**
57 * @var string
58 *
59 * @ORM\Column(name="password", type="text")
60 */
61 private $password;
62 37
63 /** 38 /**
64 * @var string 39 * @var string
65 * 40 *
66 * @ORM\Column(name="name", type="text", nullable=true) 41 * @ORM\Column(name="name", type="text", nullable=true)
67 */ 42 */
68 private $name; 43 protected $name;
69
70 /**
71 * @var string
72 *
73 * @ORM\Column(name="email", type="text", nullable=false)
74 * @Assert\Email()
75 * @Assert\NotBlank()
76 */
77 private $email;
78
79 /**
80 * @ORM\Column(name="is_active", type="boolean", nullable=false)
81 */
82 private $isActive = true;
83
84 /**
85 * @ORM\Column(name="confirmation_token", type="string", nullable=true)
86 */
87 private $confirmationToken;
88
89 /**
90 * @ORM\Column(name="password_requested_at", type="datetime", nullable=true)
91 */
92 private $passwordRequestedAt;
93 44
94 /** 45 /**
95 * @var date 46 * @var date
96 * 47 *
97 * @ORM\Column(name="created_at", type="datetime") 48 * @ORM\Column(name="created_at", type="datetime")
98 */ 49 */
99 private $createdAt; 50 protected $createdAt;
100 51
101 /** 52 /**
102 * @var date 53 * @var date
103 * 54 *
104 * @ORM\Column(name="updated_at", type="datetime") 55 * @ORM\Column(name="updated_at", type="datetime")
105 */ 56 */
106 private $updatedAt; 57 protected $updatedAt;
107 58
108 /** 59 /**
109 * @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"}) 60 * @ORM\OneToMany(targetEntity="Entry", mappedBy="user", cascade={"remove"})
110 */ 61 */
111 private $entries; 62 protected $entries;
112 63
113 /** 64 /**
114 * @ORM\OneToOne(targetEntity="Config", mappedBy="user") 65 * @ORM\OneToOne(targetEntity="Config", mappedBy="user")
115 */ 66 */
116 private $config; 67 protected $config;
117 68
118 /** 69 /**
119 * @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"}) 70 * @ORM\OneToMany(targetEntity="Tag", mappedBy="user", cascade={"remove"})
120 */ 71 */
121 private $tags; 72 protected $tags;
122 73
123 public function __construct() 74 public function __construct()
124 { 75 {
125 $this->isActive = true; 76 parent::__construct();
126 $this->salt = md5(uniqid(null, true)); 77 $this->entries = new ArrayCollection();
127 $this->entries = new ArrayCollection(); 78 $this->tags = new ArrayCollection();
128 $this->tags = new ArrayCollection();
129 } 79 }
130 80
131 /** 81 /**
@@ -142,56 +92,6 @@ class User implements AdvancedUserInterface, \Serializable
142 } 92 }
143 93
144 /** 94 /**
145 * Get id.
146 *
147 * @return int
148 */
149 public function getId()
150 {
151 return $this->id;
152 }
153
154 /**
155 * Set username.
156 *
157 * @param string $username
158 *
159 * @return User
160 */
161 public function setUsername($username)
162 {
163 $this->username = $username;
164
165 return $this;
166 }
167
168 /**
169 * Get username.
170 *
171 * @return string
172 */
173 public function getUsername()
174 {
175 return $this->username;
176 }
177
178 /**
179 * {@inheritdoc}
180 */
181 public function getSalt()
182 {
183 return $this->salt;
184 }
185
186 /**
187 * {@inheritdoc}
188 */
189 public function getRoles()
190 {
191 return array('ROLE_USER');
192 }
193
194 /**
195 * Set password. 95 * Set password.
196 * 96 *
197 * @param string $password 97 * @param string $password
@@ -210,16 +110,6 @@ class User implements AdvancedUserInterface, \Serializable
210 } 110 }
211 111
212 /** 112 /**
213 * Get password.
214 *
215 * @return string
216 */
217 public function getPassword()
218 {
219 return $this->password;
220 }
221
222 /**
223 * Set name. 113 * Set name.
224 * 114 *
225 * @param string $name 115 * @param string $name
@@ -244,30 +134,6 @@ class User implements AdvancedUserInterface, \Serializable
244 } 134 }
245 135
246 /** 136 /**
247 * Set email.
248 *
249 * @param string $email
250 *
251 * @return User
252 */
253 public function setEmail($email)
254 {
255 $this->email = $email;
256
257 return $this;
258 }
259
260 /**
261 * Get email.
262 *
263 * @return string
264 */
265 public function getEmail()
266 {
267 return $this->email;
268 }
269
270 /**
271 * @return string 137 * @return string
272 */ 138 */
273 public function getCreatedAt() 139 public function getCreatedAt()
@@ -322,56 +188,12 @@ class User implements AdvancedUserInterface, \Serializable
322 { 188 {
323 return $this->tags; 189 return $this->tags;
324 } 190 }
325 /**
326 * {@inheritdoc}
327 */
328 public function eraseCredentials()
329 {
330 }
331
332 /**
333 * @see \Serializable::serialize()
334 */
335 public function serialize()
336 {
337 return serialize(array(
338 $this->id,
339 ));
340 }
341
342 /**
343 * @see \Serializable::unserialize()
344 */
345 public function unserialize($serialized)
346 {
347 list(
348 $this->id) = unserialize($serialized);
349 }
350 191
351 public function isEqualTo(UserInterface $user) 192 public function isEqualTo(UserInterface $user)
352 { 193 {
353 return $this->username === $user->getUsername(); 194 return $this->username === $user->getUsername();
354 } 195 }
355 196
356 public function isAccountNonExpired()
357 {
358 return true;
359 }
360
361 public function isAccountNonLocked()
362 {
363 return true;
364 }
365
366 public function isCredentialsNonExpired()
367 {
368 return true;
369 }
370
371 public function isEnabled()
372 {
373 return $this->isActive;
374 }
375 /** 197 /**
376 * Set config. 198 * Set config.
377 * 199 *
@@ -395,52 +217,4 @@ class User implements AdvancedUserInterface, \Serializable
395 { 217 {
396 return $this->config; 218 return $this->config;
397 } 219 }
398
399 /**
400 * Set confirmationToken.
401 *
402 * @param string $confirmationToken
403 *
404 * @return User
405 */
406 public function setConfirmationToken($confirmationToken)
407 {
408 $this->confirmationToken = $confirmationToken;
409
410 return $this;
411 }
412
413 /**
414 * Get confirmationToken.
415 *
416 * @return string
417 */
418 public function getConfirmationToken()
419 {
420 return $this->confirmationToken;
421 }
422
423 /**
424 * Set passwordRequestedAt.
425 *
426 * @param \DateTime $passwordRequestedAt
427 *
428 * @return User
429 */
430 public function setPasswordRequestedAt($passwordRequestedAt)
431 {
432 $this->passwordRequestedAt = $passwordRequestedAt;
433
434 return $this;
435 }
436
437 /**
438 * Get passwordRequestedAt.
439 *
440 * @return \DateTime
441 */
442 public function getPasswordRequestedAt()
443 {
444 return $this->passwordRequestedAt;
445 }
446} 220}
diff --git a/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig b/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig
index f669574e..5437d20c 100644
--- a/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/Security/login.html.twig
@@ -30,6 +30,7 @@
30 </div> 30 </div>
31 31
32 <div class="row mts txtcenter"> 32 <div class="row mts txtcenter">
33 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
33 <button type="submit">Login</button> 34 <button type="submit">Login</button>
34 <a href="{{ path('forgot_password') }}" class="small">Forgot your password?</a> 35 <a href="{{ path('forgot_password') }}" class="small">Forgot your password?</a>
35 </div> 36 </div>
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
index 3711f6e5..1ecaecc5 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entries.html.twig
@@ -58,7 +58,6 @@
58 {% endfor %} 58 {% endfor %}
59 </ul> 59 </ul>
60 60
61
62 <!-- Filters --> 61 <!-- Filters -->
63 <div id="filters" class="side-nav fixed right-aligned"> 62 <div id="filters" class="side-nav fixed right-aligned">
64 <form action="{{ path('all') }}"> 63 <form action="{{ path('all') }}">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig
index 2c513ffe..c9979198 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Security/login.html.twig
@@ -44,6 +44,7 @@
44 44
45 </div> 45 </div>
46 <div class="card-action"> 46 <div class="card-action">
47 <input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}" />
47 <button class="btn waves-effect waves-light" type="submit" name="send"> 48 <button class="btn waves-effect waves-light" type="submit" name="send">
48 {% trans %}Login{% endtrans %} 49 {% trans %}Login{% endtrans %}
49 <i class="mdi-content-send right"></i> 50 <i class="mdi-content-send right"></i>
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
index 7a819953..3067e5a4 100644
--- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
@@ -75,7 +75,7 @@ class InstallCommandTest extends WallabagCoreTestCase
75 ->getMock(); 75 ->getMock();
76 $dialog->expects($this->any()) 76 $dialog->expects($this->any())
77 ->method('ask') 77 ->method('ask')
78 ->will($this->returnValue('test')); 78 ->will($this->returnValue('test2'));
79 $dialog->expects($this->any()) 79 $dialog->expects($this->any())
80 ->method('askConfirmation') 80 ->method('askConfirmation')
81 ->will($this->returnValue(true)); 81 ->will($this->returnValue(true));
diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
index 5ab9c329..e11da935 100644
--- a/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Controller/ConfigControllerTest.php
@@ -266,7 +266,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
266 array( 266 array(
267 array( 267 array(
268 'new_user[username]' => 'ad', 268 'new_user[username]' => 'ad',
269 'new_user[password]' => '', 269 'new_user[password]' => 'mypassword',
270 'new_user[email]' => '', 270 'new_user[email]' => '',
271 ), 271 ),
272 'This value is too short.', 272 'This value is too short.',
@@ -274,7 +274,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
274 array( 274 array(
275 array( 275 array(
276 'new_user[username]' => 'wallace', 276 'new_user[username]' => 'wallace',
277 'new_user[password]' => '', 277 'new_user[password]' => 'mypassword',
278 'new_user[email]' => 'test', 278 'new_user[email]' => 'test',
279 ), 279 ),
280 'This value is not a valid email address.', 280 'This value is not a valid email address.',