aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--app/AppKernel.php1
-rw-r--r--app/config/config.yml13
-rw-r--r--composer.json3
-rw-r--r--composer.lock319
-rw-r--r--src/Wallabag/CoreBundle/Form/Type/UserInformationType.php1
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig8
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig8
-rw-r--r--src/Wallabag/UserBundle/Entity/User.php68
-rw-r--r--src/Wallabag/UserBundle/Resources/config/services.yml19
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/baggy/Authentication/form.html.twig32
-rw-r--r--src/Wallabag/UserBundle/Resources/views/themes/material/Authentication/form.html.twig33
11 files changed, 394 insertions, 111 deletions
diff --git a/app/AppKernel.php b/app/AppKernel.php
index 6315fcde..2475fe16 100644
--- a/app/AppKernel.php
+++ b/app/AppKernel.php
@@ -28,6 +28,7 @@ class AppKernel extends Kernel
28 new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(), 28 new Lexik\Bundle\FormFilterBundle\LexikFormFilterBundle(),
29 new FOS\OAuthServerBundle\FOSOAuthServerBundle(), 29 new FOS\OAuthServerBundle\FOSOAuthServerBundle(),
30 new Wallabag\UserBundle\WallabagUserBundle(), 30 new Wallabag\UserBundle\WallabagUserBundle(),
31 new Scheb\TwoFactorBundle\SchebTwoFactorBundle(),
31 ); 32 );
32 33
33 if (in_array($this->getEnvironment(), array('dev', 'test'))) { 34 if (in_array($this->getEnvironment(), array('dev', 'test'))) {
diff --git a/app/config/config.yml b/app/config/config.yml
index 0d893ecf..b2699c83 100644
--- a/app/config/config.yml
+++ b/app/config/config.yml
@@ -171,3 +171,16 @@ fos_oauth_server:
171 auth_code_class: Wallabag\ApiBundle\Entity\AuthCode 171 auth_code_class: Wallabag\ApiBundle\Entity\AuthCode
172 service: 172 service:
173 user_provider: fos_user.user_manager 173 user_provider: fos_user.user_manager
174
175scheb_two_factor:
176
177 trusted_computer:
178 enabled: true
179 cookie_name: wllbg_trusted_computer
180 cookie_lifetime: 5184000
181
182 email:
183 enabled: true
184 sender_email: no-reply@wallabag.org
185 digits: 6
186 template: WallabagUserBundle:Authentication:form.html.twig
diff --git a/composer.json b/composer.json
index 22cb277c..e16de833 100644
--- a/composer.json
+++ b/composer.json
@@ -54,7 +54,8 @@
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 "friendsofsymfony/user-bundle": "dev-master",
57 "friendsofsymfony/oauth-server-bundle": "^1.4@dev" 57 "friendsofsymfony/oauth-server-bundle": "^1.4@dev",
58 "scheb/two-factor-bundle": "~1.4"
58 }, 59 },
59 "require-dev": { 60 "require-dev": {
60 "doctrine/doctrine-fixtures-bundle": "~2.2.0", 61 "doctrine/doctrine-fixtures-bundle": "~2.2.0",
diff --git a/composer.lock b/composer.lock
index 606c3678..13e94821 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": "7c1f2c88df608eb6e1b4bc7c5ed24acc", 7 "hash": "7fb67fafde0e24c1802714a2a47da5e1",
8 "packages": [ 8 "packages": [
9 { 9 {
10 "name": "doctrine/annotations", 10 "name": "doctrine/annotations",
@@ -813,52 +813,6 @@
813 "time": "2015-08-05 01:03:42" 813 "time": "2015-08-05 01:03:42"
814 }, 814 },
815 { 815 {
816 "name": "fin1te/safecurl",
817 "version": "v1.1",
818 "source": {
819 "type": "git",
820 "url": "https://github.com/fin1te/safecurl.git",
821 "reference": "98aae75a1f4f8dec2194ce889d418d16c3c877e4"
822 },
823 "dist": {
824 "type": "zip",
825 "url": "https://api.github.com/repos/fin1te/safecurl/zipball/98aae75a1f4f8dec2194ce889d418d16c3c877e4",
826 "reference": "98aae75a1f4f8dec2194ce889d418d16c3c877e4",
827 "shasum": ""
828 },
829 "require": {
830 "php": ">=5.3.0"
831 },
832 "require-dev": {
833 "phpunit/phpunit": "3.7.*"
834 },
835 "type": "library",
836 "autoload": {
837 "psr-0": {
838 "fin1te\\SafeCurl": "src/"
839 }
840 },
841 "notification-url": "https://packagist.org/downloads/",
842 "license": [
843 "MIT"
844 ],
845 "authors": [
846 {
847 "name": "Jack W",
848 "email": "jack@fin1te.net"
849 }
850 ],
851 "description": "A drop-in replacement for 'curl_exec', designed to prevent SSRF attacks.",
852 "keywords": [
853 "curl",
854 "safe",
855 "safecurl",
856 "ssrf",
857 "websec"
858 ],
859 "time": "2014-05-20 12:10:12"
860 },
861 {
862 "name": "friendsofsymfony/oauth-server-bundle", 816 "name": "friendsofsymfony/oauth-server-bundle",
863 "version": "1.4.2", 817 "version": "1.4.2",
864 "target-dir": "FOS/OAuthServerBundle", 818 "target-dir": "FOS/OAuthServerBundle",
@@ -1390,24 +1344,24 @@
1390 }, 1344 },
1391 { 1345 {
1392 "name": "j0k3r/graby", 1346 "name": "j0k3r/graby",
1393 "version": "1.0.0-alpha.2", 1347 "version": "1.0.1",
1394 "source": { 1348 "source": {
1395 "type": "git", 1349 "type": "git",
1396 "url": "https://github.com/j0k3r/graby.git", 1350 "url": "https://github.com/j0k3r/graby.git",
1397 "reference": "9cc399bbe70f12b302ea65e604a80ea738042599" 1351 "reference": "f1d655bb680eded0dde8cf26fae1e931f69b6b12"
1398 }, 1352 },
1399 "dist": { 1353 "dist": {
1400 "type": "zip", 1354 "type": "zip",
1401 "url": "https://api.github.com/repos/j0k3r/graby/zipball/9cc399bbe70f12b302ea65e604a80ea738042599", 1355 "url": "https://api.github.com/repos/j0k3r/graby/zipball/f1d655bb680eded0dde8cf26fae1e931f69b6b12",
1402 "reference": "9cc399bbe70f12b302ea65e604a80ea738042599", 1356 "reference": "f1d655bb680eded0dde8cf26fae1e931f69b6b12",
1403 "shasum": "" 1357 "shasum": ""
1404 }, 1358 },
1405 "require": { 1359 "require": {
1406 "fin1te/safecurl": "~1.1",
1407 "guzzlehttp/guzzle": "^5.2.0", 1360 "guzzlehttp/guzzle": "^5.2.0",
1408 "htmlawed/htmlawed": "^1.1.19", 1361 "htmlawed/htmlawed": "^1.1.19",
1409 "j0k3r/graby-site-config": "^1.0.0", 1362 "j0k3r/graby-site-config": "^1.0.0",
1410 "j0k3r/php-readability": "^1.0", 1363 "j0k3r/php-readability": "^1.0",
1364 "j0k3r/safecurl": "1.1.1",
1411 "monolog/monolog": "^1.13.1", 1365 "monolog/monolog": "^1.13.1",
1412 "neitanod/forceutf8": "^1.4", 1366 "neitanod/forceutf8": "^1.4",
1413 "php": ">=5.4", 1367 "php": ">=5.4",
@@ -1438,20 +1392,20 @@
1438 } 1392 }
1439 ], 1393 ],
1440 "description": "Graby helps you extract article content from web pages", 1394 "description": "Graby helps you extract article content from web pages",
1441 "time": "2015-09-17 11:43:10" 1395 "time": "2015-10-01 18:39:53"
1442 }, 1396 },
1443 { 1397 {
1444 "name": "j0k3r/graby-site-config", 1398 "name": "j0k3r/graby-site-config",
1445 "version": "1.0.3", 1399 "version": "1.0.4",
1446 "source": { 1400 "source": {
1447 "type": "git", 1401 "type": "git",
1448 "url": "https://github.com/j0k3r/graby-site-config.git", 1402 "url": "https://github.com/j0k3r/graby-site-config.git",
1449 "reference": "1b0ac25687aa33785c5d9d8ede92b26f757354f5" 1403 "reference": "cf088ca2100eeec3f230cc187a5b489e61fe97f1"
1450 }, 1404 },
1451 "dist": { 1405 "dist": {
1452 "type": "zip", 1406 "type": "zip",
1453 "url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/1b0ac25687aa33785c5d9d8ede92b26f757354f5", 1407 "url": "https://api.github.com/repos/j0k3r/graby-site-config/zipball/cf088ca2100eeec3f230cc187a5b489e61fe97f1",
1454 "reference": "1b0ac25687aa33785c5d9d8ede92b26f757354f5", 1408 "reference": "cf088ca2100eeec3f230cc187a5b489e61fe97f1",
1455 "shasum": "" 1409 "shasum": ""
1456 }, 1410 },
1457 "require": { 1411 "require": {
@@ -1474,7 +1428,7 @@
1474 } 1428 }
1475 ], 1429 ],
1476 "description": "Graby site config files", 1430 "description": "Graby site config files",
1477 "time": "2015-09-17 17:32:42" 1431 "time": "2015-10-06 07:07:37"
1478 }, 1432 },
1479 { 1433 {
1480 "name": "j0k3r/php-readability", 1434 "name": "j0k3r/php-readability",
@@ -1540,6 +1494,54 @@
1540 "time": "2015-09-23 19:09:38" 1494 "time": "2015-09-23 19:09:38"
1541 }, 1495 },
1542 { 1496 {
1497 "name": "j0k3r/safecurl",
1498 "version": "v1.1.1",
1499 "source": {
1500 "type": "git",
1501 "url": "https://github.com/j0k3r/safecurl.git",
1502 "reference": "3e8594a944ede2b74f3e24e371f2770bbfed6aa5"
1503 },
1504 "dist": {
1505 "type": "zip",
1506 "url": "https://api.github.com/repos/j0k3r/safecurl/zipball/3e8594a944ede2b74f3e24e371f2770bbfed6aa5",
1507 "reference": "3e8594a944ede2b74f3e24e371f2770bbfed6aa5",
1508 "shasum": ""
1509 },
1510 "require": {
1511 "php": ">=5.3.0"
1512 },
1513 "type": "library",
1514 "autoload": {
1515 "psr-0": {
1516 "fin1te\\SafeCurl": "src/"
1517 }
1518 },
1519 "notification-url": "https://packagist.org/downloads/",
1520 "license": [
1521 "MIT"
1522 ],
1523 "authors": [
1524 {
1525 "name": "Jeremy Benoist",
1526 "email": "jeremy.benoist@gmail.com"
1527 },
1528 {
1529 "name": "Jack W",
1530 "email": "jack@fin1te.net",
1531 "role": "Developer (original version)"
1532 }
1533 ],
1534 "description": "A drop-in replacement for 'curl_exec', designed to prevent SSRF attacks.",
1535 "keywords": [
1536 "curl",
1537 "safe",
1538 "safecurl",
1539 "ssrf",
1540 "websec"
1541 ],
1542 "time": "2015-10-01 18:30:41"
1543 },
1544 {
1543 "name": "jdorn/sql-formatter", 1545 "name": "jdorn/sql-formatter",
1544 "version": "v1.2.17", 1546 "version": "v1.2.17",
1545 "source": { 1547 "source": {
@@ -2597,6 +2599,55 @@
2597 "time": "2015-07-03 13:48:55" 2599 "time": "2015-07-03 13:48:55"
2598 }, 2600 },
2599 { 2601 {
2602 "name": "scheb/two-factor-bundle",
2603 "version": "v1.4.7",
2604 "source": {
2605 "type": "git",
2606 "url": "https://github.com/scheb/two-factor-bundle.git",
2607 "reference": "ef6830dbbf62b22efd335db8f64bf0f51d4284a2"
2608 },
2609 "dist": {
2610 "type": "zip",
2611 "url": "https://api.github.com/repos/scheb/two-factor-bundle/zipball/ef6830dbbf62b22efd335db8f64bf0f51d4284a2",
2612 "reference": "ef6830dbbf62b22efd335db8f64bf0f51d4284a2",
2613 "shasum": ""
2614 },
2615 "require": {
2616 "sonata-project/google-authenticator": "~1.0",
2617 "symfony/symfony": "~2.1"
2618 },
2619 "require-dev": {
2620 "satooshi/php-coveralls": "~0.6",
2621 "swiftmailer/swiftmailer": ">=4.3, <6.0",
2622 "symfony/phpunit-bridge": "~2.7"
2623 },
2624 "type": "symfony-bundle",
2625 "autoload": {
2626 "psr-4": {
2627 "Scheb\\TwoFactorBundle\\": ""
2628 }
2629 },
2630 "notification-url": "https://packagist.org/downloads/",
2631 "license": [
2632 "MIT"
2633 ],
2634 "authors": [
2635 {
2636 "name": "Christian Scheb",
2637 "email": "me@christianscheb.de"
2638 }
2639 ],
2640 "description": "Provides two-factor authenticaton for Symfony2",
2641 "homepage": "https://github.com/scheb/two-factor-bundle",
2642 "keywords": [
2643 "Authentication",
2644 "Symfony2",
2645 "two-factor",
2646 "two-step"
2647 ],
2648 "time": "2015-08-25 19:58:00"
2649 },
2650 {
2600 "name": "sensio/distribution-bundle", 2651 "name": "sensio/distribution-bundle",
2601 "version": "v3.0.31", 2652 "version": "v3.0.31",
2602 "target-dir": "Sensio/Bundle/DistributionBundle", 2653 "target-dir": "Sensio/Bundle/DistributionBundle",
@@ -2853,6 +2904,56 @@
2853 "time": "2015-09-18 08:29:33" 2904 "time": "2015-09-18 08:29:33"
2854 }, 2905 },
2855 { 2906 {
2907 "name": "sonata-project/google-authenticator",
2908 "version": "1.0.2",
2909 "source": {
2910 "type": "git",
2911 "url": "https://github.com/sonata-project/GoogleAuthenticator.git",
2912 "reference": "72f47caddd09d09c0d3c3e046f6b435e0c004cd4"
2913 },
2914 "dist": {
2915 "type": "zip",
2916 "url": "https://api.github.com/repos/sonata-project/GoogleAuthenticator/zipball/72f47caddd09d09c0d3c3e046f6b435e0c004cd4",
2917 "reference": "72f47caddd09d09c0d3c3e046f6b435e0c004cd4",
2918 "shasum": ""
2919 },
2920 "require": {
2921 "php": ">=5.3.0"
2922 },
2923 "type": "library",
2924 "autoload": {
2925 "psr-4": {
2926 "Google\\Authenticator\\": "lib/",
2927 "Google\\Authenticator\\Tests\\": "tests/"
2928 }
2929 },
2930 "notification-url": "https://packagist.org/downloads/",
2931 "license": [
2932 "MIT"
2933 ],
2934 "authors": [
2935 {
2936 "name": "Thomas Rabaix",
2937 "email": "thomas.rabaix@gmail.com",
2938 "homepage": "http://sonata-project.org/"
2939 },
2940 {
2941 "name": "Christian Stocker",
2942 "email": "me@chregu.tv"
2943 },
2944 {
2945 "name": "Andre DeMarre",
2946 "homepage": "http://www.devnetwork.net/viewtopic.php?f=50&t=94989"
2947 }
2948 ],
2949 "description": "Library to integrate Google Authenticator into a PHP project",
2950 "homepage": "https://github.com/sonata-project/GoogleAuthenticator",
2951 "keywords": [
2952 "google authenticator"
2953 ],
2954 "time": "2014-03-31 09:18:53"
2955 },
2956 {
2856 "name": "swiftmailer/swiftmailer", 2957 "name": "swiftmailer/swiftmailer",
2857 "version": "v5.4.1", 2958 "version": "v5.4.1",
2858 "source": { 2959 "source": {
@@ -2977,34 +3078,34 @@
2977 }, 3078 },
2978 { 3079 {
2979 "name": "symfony/monolog-bundle", 3080 "name": "symfony/monolog-bundle",
2980 "version": "v2.7.1", 3081 "version": "2.8.1",
2981 "source": { 3082 "source": {
2982 "type": "git", 3083 "type": "git",
2983 "url": "https://github.com/symfony/monolog-bundle.git", 3084 "url": "https://github.com/symfony/monolog-bundle.git",
2984 "reference": "9320b6863404c70ebe111e9040dab96f251de7ac" 3085 "reference": "7117b9a145722e3c5768db4585f6ad0643ed5c4a"
2985 }, 3086 },
2986 "dist": { 3087 "dist": {
2987 "type": "zip", 3088 "type": "zip",
2988 "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/9320b6863404c70ebe111e9040dab96f251de7ac", 3089 "url": "https://api.github.com/repos/symfony/monolog-bundle/zipball/7117b9a145722e3c5768db4585f6ad0643ed5c4a",
2989 "reference": "9320b6863404c70ebe111e9040dab96f251de7ac", 3090 "reference": "7117b9a145722e3c5768db4585f6ad0643ed5c4a",
2990 "shasum": "" 3091 "shasum": ""
2991 }, 3092 },
2992 "require": { 3093 "require": {
2993 "monolog/monolog": "~1.8", 3094 "monolog/monolog": "~1.8",
2994 "php": ">=5.3.2", 3095 "php": ">=5.3.2",
2995 "symfony/config": "~2.3", 3096 "symfony/config": "~2.3|3.*",
2996 "symfony/dependency-injection": "~2.3", 3097 "symfony/dependency-injection": "~2.3|3.*",
2997 "symfony/http-kernel": "~2.3", 3098 "symfony/http-kernel": "~2.3|3.*",
2998 "symfony/monolog-bridge": "~2.3" 3099 "symfony/monolog-bridge": "~2.3|3.*"
2999 }, 3100 },
3000 "require-dev": { 3101 "require-dev": {
3001 "symfony/console": "~2.3", 3102 "symfony/console": "~2.3|3.*",
3002 "symfony/yaml": "~2.3" 3103 "symfony/yaml": "~2.3"
3003 }, 3104 },
3004 "type": "symfony-bundle", 3105 "type": "symfony-bundle",
3005 "extra": { 3106 "extra": {
3006 "branch-alias": { 3107 "branch-alias": {
3007 "dev-master": "2.7.x-dev" 3108 "dev-master": "2.8.x-dev"
3008 } 3109 }
3009 }, 3110 },
3010 "autoload": { 3111 "autoload": {
@@ -3032,7 +3133,7 @@
3032 "log", 3133 "log",
3033 "logging" 3134 "logging"
3034 ], 3135 ],
3035 "time": "2015-01-04 20:21:17" 3136 "time": "2015-10-02 11:51:59"
3036 }, 3137 },
3037 { 3138 {
3038 "name": "symfony/swiftmailer-bundle", 3139 "name": "symfony/swiftmailer-bundle",
@@ -3093,20 +3194,20 @@
3093 }, 3194 },
3094 { 3195 {
3095 "name": "symfony/symfony", 3196 "name": "symfony/symfony",
3096 "version": "v2.7.4", 3197 "version": "v2.7.5",
3097 "source": { 3198 "source": {
3098 "type": "git", 3199 "type": "git",
3099 "url": "https://github.com/symfony/symfony.git", 3200 "url": "https://github.com/symfony/symfony.git",
3100 "reference": "1fdf23fe28876844b887b0e1935c9adda43ee645" 3201 "reference": "619528a274647cffc1792063c3ea04c4fa8266a0"
3101 }, 3202 },
3102 "dist": { 3203 "dist": {
3103 "type": "zip", 3204 "type": "zip",
3104 "url": "https://api.github.com/repos/symfony/symfony/zipball/1fdf23fe28876844b887b0e1935c9adda43ee645", 3205 "url": "https://api.github.com/repos/symfony/symfony/zipball/619528a274647cffc1792063c3ea04c4fa8266a0",
3105 "reference": "1fdf23fe28876844b887b0e1935c9adda43ee645", 3206 "reference": "619528a274647cffc1792063c3ea04c4fa8266a0",
3106 "shasum": "" 3207 "shasum": ""
3107 }, 3208 },
3108 "require": { 3209 "require": {
3109 "doctrine/common": "~2.3", 3210 "doctrine/common": "~2.4",
3110 "php": ">=5.3.9", 3211 "php": ">=5.3.9",
3111 "psr/log": "~1.0", 3212 "psr/log": "~1.0",
3112 "twig/twig": "~1.20|~2.0" 3213 "twig/twig": "~1.20|~2.0"
@@ -3159,9 +3260,9 @@
3159 }, 3260 },
3160 "require-dev": { 3261 "require-dev": {
3161 "doctrine/data-fixtures": "1.0.*", 3262 "doctrine/data-fixtures": "1.0.*",
3162 "doctrine/dbal": "~2.2", 3263 "doctrine/dbal": "~2.4",
3163 "doctrine/doctrine-bundle": "~1.2", 3264 "doctrine/doctrine-bundle": "~1.2",
3164 "doctrine/orm": "~2.2,>=2.2.3", 3265 "doctrine/orm": "~2.4,>=2.4.5",
3165 "egulias/email-validator": "~1.2", 3266 "egulias/email-validator": "~1.2",
3166 "ircmaxell/password-compat": "~1.0", 3267 "ircmaxell/password-compat": "~1.0",
3167 "monolog/monolog": "~1.11", 3268 "monolog/monolog": "~1.11",
@@ -3211,7 +3312,7 @@
3211 "keywords": [ 3312 "keywords": [
3212 "framework" 3313 "framework"
3213 ], 3314 ],
3214 "time": "2015-09-08 14:26:39" 3315 "time": "2015-09-25 11:16:52"
3215 }, 3316 },
3216 { 3317 {
3217 "name": "tecnickcom/tcpdf", 3318 "name": "tecnickcom/tcpdf",
@@ -3330,16 +3431,16 @@
3330 }, 3431 },
3331 { 3432 {
3332 "name": "twig/twig", 3433 "name": "twig/twig",
3333 "version": "v1.22.2", 3434 "version": "v1.22.3",
3334 "source": { 3435 "source": {
3335 "type": "git", 3436 "type": "git",
3336 "url": "https://github.com/twigphp/Twig.git", 3437 "url": "https://github.com/twigphp/Twig.git",
3337 "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a" 3438 "reference": "ebfc36b7e77b0c1175afe30459cf943010245540"
3338 }, 3439 },
3339 "dist": { 3440 "dist": {
3340 "type": "zip", 3441 "type": "zip",
3341 "url": "https://api.github.com/repos/twigphp/Twig/zipball/79249fc8c9ff62e41e217e0c630e2e00bcadda6a", 3442 "url": "https://api.github.com/repos/twigphp/Twig/zipball/ebfc36b7e77b0c1175afe30459cf943010245540",
3342 "reference": "79249fc8c9ff62e41e217e0c630e2e00bcadda6a", 3443 "reference": "ebfc36b7e77b0c1175afe30459cf943010245540",
3343 "shasum": "" 3444 "shasum": ""
3344 }, 3445 },
3345 "require": { 3446 "require": {
@@ -3387,7 +3488,7 @@
3387 "keywords": [ 3488 "keywords": [
3388 "templating" 3489 "templating"
3389 ], 3490 ],
3390 "time": "2015-09-22 13:59:32" 3491 "time": "2015-10-13 07:07:02"
3391 }, 3492 },
3392 { 3493 {
3393 "name": "willdurand/hateoas", 3494 "name": "willdurand/hateoas",
@@ -3548,16 +3649,16 @@
3548 }, 3649 },
3549 { 3650 {
3550 "name": "willdurand/negotiation", 3651 "name": "willdurand/negotiation",
3551 "version": "1.4.0", 3652 "version": "1.5.0",
3552 "source": { 3653 "source": {
3553 "type": "git", 3654 "type": "git",
3554 "url": "https://github.com/willdurand/Negotiation.git", 3655 "url": "https://github.com/willdurand/Negotiation.git",
3555 "reference": "8a84c5956e765f432542fc52a8c6e9aff4508eb3" 3656 "reference": "2a59f2376557303e3fa91465ab691abb82945edf"
3556 }, 3657 },
3557 "dist": { 3658 "dist": {
3558 "type": "zip", 3659 "type": "zip",
3559 "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/8a84c5956e765f432542fc52a8c6e9aff4508eb3", 3660 "url": "https://api.github.com/repos/willdurand/Negotiation/zipball/2a59f2376557303e3fa91465ab691abb82945edf",
3560 "reference": "8a84c5956e765f432542fc52a8c6e9aff4508eb3", 3661 "reference": "2a59f2376557303e3fa91465ab691abb82945edf",
3561 "shasum": "" 3662 "shasum": ""
3562 }, 3663 },
3563 "require": { 3664 "require": {
@@ -3566,7 +3667,7 @@
3566 "type": "library", 3667 "type": "library",
3567 "extra": { 3668 "extra": {
3568 "branch-alias": { 3669 "branch-alias": {
3569 "dev-master": "1.4-dev" 3670 "dev-master": "1.5-dev"
3570 } 3671 }
3571 }, 3672 },
3572 "autoload": { 3673 "autoload": {
@@ -3580,7 +3681,7 @@
3580 ], 3681 ],
3581 "authors": [ 3682 "authors": [
3582 { 3683 {
3583 "name": "William DURAND", 3684 "name": "William Durand",
3584 "email": "william.durand1@gmail.com" 3685 "email": "william.durand1@gmail.com"
3585 } 3686 }
3586 ], 3687 ],
@@ -3593,7 +3694,7 @@
3593 "header", 3694 "header",
3594 "negotiation" 3695 "negotiation"
3595 ], 3696 ],
3596 "time": "2015-07-28 13:10:50" 3697 "time": "2015-10-01 07:42:40"
3597 } 3698 }
3598 ], 3699 ],
3599 "packages-dev": [ 3700 "packages-dev": [
@@ -3822,16 +3923,16 @@
3822 }, 3923 },
3823 { 3924 {
3824 "name": "phpunit/php-code-coverage", 3925 "name": "phpunit/php-code-coverage",
3825 "version": "2.2.3", 3926 "version": "2.2.4",
3826 "source": { 3927 "source": {
3827 "type": "git", 3928 "type": "git",
3828 "url": "https://github.com/sebastianbergmann/php-code-coverage.git", 3929 "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
3829 "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f" 3930 "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979"
3830 }, 3931 },
3831 "dist": { 3932 "dist": {
3832 "type": "zip", 3933 "type": "zip",
3833 "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ef1ca6835468857944d5c3b48fa503d5554cff2f", 3934 "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/eabf68b476ac7d0f73793aada060f1c1a9bf8979",
3834 "reference": "ef1ca6835468857944d5c3b48fa503d5554cff2f", 3935 "reference": "eabf68b476ac7d0f73793aada060f1c1a9bf8979",
3835 "shasum": "" 3936 "shasum": ""
3836 }, 3937 },
3837 "require": { 3938 "require": {
@@ -3880,7 +3981,7 @@
3880 "testing", 3981 "testing",
3881 "xunit" 3982 "xunit"
3882 ], 3983 ],
3883 "time": "2015-09-14 06:51:16" 3984 "time": "2015-10-06 15:47:00"
3884 }, 3985 },
3885 { 3986 {
3886 "name": "phpunit/php-file-iterator", 3987 "name": "phpunit/php-file-iterator",
@@ -4062,16 +4163,16 @@
4062 }, 4163 },
4063 { 4164 {
4064 "name": "phpunit/phpunit", 4165 "name": "phpunit/phpunit",
4065 "version": "4.8.9", 4166 "version": "4.8.12",
4066 "source": { 4167 "source": {
4067 "type": "git", 4168 "type": "git",
4068 "url": "https://github.com/sebastianbergmann/phpunit.git", 4169 "url": "https://github.com/sebastianbergmann/phpunit.git",
4069 "reference": "73fad41adb5b7bc3a494bb930d90648df1d5e74b" 4170 "reference": "00194eb95989190a73198390ceca081ad3441a7f"
4070 }, 4171 },
4071 "dist": { 4172 "dist": {
4072 "type": "zip", 4173 "type": "zip",
4073 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/73fad41adb5b7bc3a494bb930d90648df1d5e74b", 4174 "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/00194eb95989190a73198390ceca081ad3441a7f",
4074 "reference": "73fad41adb5b7bc3a494bb930d90648df1d5e74b", 4175 "reference": "00194eb95989190a73198390ceca081ad3441a7f",
4075 "shasum": "" 4176 "shasum": ""
4076 }, 4177 },
4077 "require": { 4178 "require": {
@@ -4130,20 +4231,20 @@
4130 "testing", 4231 "testing",
4131 "xunit" 4232 "xunit"
4132 ], 4233 ],
4133 "time": "2015-09-20 12:56:44" 4234 "time": "2015-10-12 03:36:47"
4134 }, 4235 },
4135 { 4236 {
4136 "name": "phpunit/phpunit-mock-objects", 4237 "name": "phpunit/phpunit-mock-objects",
4137 "version": "2.3.7", 4238 "version": "2.3.8",
4138 "source": { 4239 "source": {
4139 "type": "git", 4240 "type": "git",
4140 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", 4241 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
4141 "reference": "5e2645ad49d196e020b85598d7c97e482725786a" 4242 "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983"
4142 }, 4243 },
4143 "dist": { 4244 "dist": {
4144 "type": "zip", 4245 "type": "zip",
4145 "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5e2645ad49d196e020b85598d7c97e482725786a", 4246 "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/ac8e7a3db35738d56ee9a76e78a4e03d97628983",
4146 "reference": "5e2645ad49d196e020b85598d7c97e482725786a", 4247 "reference": "ac8e7a3db35738d56ee9a76e78a4e03d97628983",
4147 "shasum": "" 4248 "shasum": ""
4148 }, 4249 },
4149 "require": { 4250 "require": {
@@ -4186,7 +4287,7 @@
4186 "mock", 4287 "mock",
4187 "xunit" 4288 "xunit"
4188 ], 4289 ],
4189 "time": "2015-08-19 09:14:08" 4290 "time": "2015-10-02 06:51:40"
4190 }, 4291 },
4191 { 4292 {
4192 "name": "sebastian/comparator", 4293 "name": "sebastian/comparator",
@@ -4422,16 +4523,16 @@
4422 }, 4523 },
4423 { 4524 {
4424 "name": "sebastian/global-state", 4525 "name": "sebastian/global-state",
4425 "version": "1.0.0", 4526 "version": "1.1.1",
4426 "source": { 4527 "source": {
4427 "type": "git", 4528 "type": "git",
4428 "url": "https://github.com/sebastianbergmann/global-state.git", 4529 "url": "https://github.com/sebastianbergmann/global-state.git",
4429 "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01" 4530 "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4"
4430 }, 4531 },
4431 "dist": { 4532 "dist": {
4432 "type": "zip", 4533 "type": "zip",
4433 "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/c7428acdb62ece0a45e6306f1ae85e1c05b09c01", 4534 "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bc37d50fea7d017d3d340f230811c9f1d7280af4",
4434 "reference": "c7428acdb62ece0a45e6306f1ae85e1c05b09c01", 4535 "reference": "bc37d50fea7d017d3d340f230811c9f1d7280af4",
4435 "shasum": "" 4536 "shasum": ""
4436 }, 4537 },
4437 "require": { 4538 "require": {
@@ -4469,7 +4570,7 @@
4469 "keywords": [ 4570 "keywords": [
4470 "global state" 4571 "global state"
4471 ], 4572 ],
4472 "time": "2014-10-06 09:23:50" 4573 "time": "2015-10-12 03:26:01"
4473 }, 4574 },
4474 { 4575 {
4475 "name": "sebastian/recursion-context", 4576 "name": "sebastian/recursion-context",
diff --git a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
index 84f02013..e06c937d 100644
--- a/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
+++ b/src/Wallabag/CoreBundle/Form/Type/UserInformationType.php
@@ -13,6 +13,7 @@ class UserInformationType extends AbstractType
13 $builder 13 $builder
14 ->add('name', 'text') 14 ->add('name', 'text')
15 ->add('email', 'email') 15 ->add('email', 'email')
16 ->add('twoFactorAuthentication', 'checkbox', array('required' => false))
16 ->add('save', 'submit') 17 ->add('save', 'submit')
17 ->remove('username') 18 ->remove('username')
18 ->remove('plainPassword') 19 ->remove('plainPassword')
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
index 64305b16..cee4f672 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
@@ -100,6 +100,14 @@
100 </div> 100 </div>
101 </fieldset> 101 </fieldset>
102 102
103 <fieldset class="w500p inline">
104 <div class="row">
105 {{ form_label(form.user.twoFactorAuthentication) }}
106 {{ form_errors(form.user.twoFactorAuthentication) }}
107 {{ form_widget(form.user.twoFactorAuthentication) }}
108 </div>
109 </fieldset>
110
103 {{ form_rest(form.user) }} 111 {{ form_rest(form.user) }}
104 </form> 112 </form>
105 113
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
index 0d8e9f24..b20c4ea5 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
@@ -132,6 +132,14 @@
132 </div> 132 </div>
133 </div> 133 </div>
134 134
135 <div class="row">
136 <div class="input-field col s12">
137 {{ form_widget(form.user.twoFactorAuthentication) }}
138 {{ form_label(form.user.twoFactorAuthentication) }}
139 {{ form_errors(form.user.twoFactorAuthentication) }}
140 </div>
141 </div>
142
135 <div class="hidden">{{ form_rest(form.user) }}</div> 143 <div class="hidden">{{ form_rest(form.user) }}</div>
136 <button class="btn waves-effect waves-light" type="submit" name="action"> 144 <button class="btn waves-effect waves-light" type="submit" name="action">
137 {% trans %}Save{% endtrans %} 145 {% trans %}Save{% endtrans %}
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php
index 8f02e070..d2efd200 100644
--- a/src/Wallabag/UserBundle/Entity/User.php
+++ b/src/Wallabag/UserBundle/Entity/User.php
@@ -4,6 +4,8 @@ namespace Wallabag\UserBundle\Entity;
4 4
5use Doctrine\Common\Collections\ArrayCollection; 5use Doctrine\Common\Collections\ArrayCollection;
6use Doctrine\ORM\Mapping as ORM; 6use Doctrine\ORM\Mapping as ORM;
7use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface;
8use Scheb\TwoFactorBundle\Model\TrustedComputerInterface;
7use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; 9use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
8use Symfony\Component\Security\Core\User\UserInterface; 10use Symfony\Component\Security\Core\User\UserInterface;
9use JMS\Serializer\Annotation\ExclusionPolicy; 11use JMS\Serializer\Annotation\ExclusionPolicy;
@@ -24,7 +26,7 @@ use Wallabag\CoreBundle\Entity\Tag;
24 * @UniqueEntity("email") 26 * @UniqueEntity("email")
25 * @UniqueEntity("username") 27 * @UniqueEntity("username")
26 */ 28 */
27class User extends BaseUser 29class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface
28{ 30{
29 /** 31 /**
30 * @var int 32 * @var int
@@ -72,6 +74,22 @@ class User extends BaseUser
72 */ 74 */
73 protected $tags; 75 protected $tags;
74 76
77 /**
78 * @ORM\Column(type="integer", nullable=true)
79 */
80 private $authCode;
81
82 /**
83 * @var bool Enabled yes/no
84 * @ORM\Column(type="boolean")
85 */
86 private $twoFactorAuthentication = false;
87
88 /**
89 * @ORM\Column(type="json_array", nullable=true)
90 */
91 private $trusted;
92
75 public function __construct() 93 public function __construct()
76 { 94 {
77 parent::__construct(); 95 parent::__construct();
@@ -201,4 +219,52 @@ class User extends BaseUser
201 { 219 {
202 return $this->config; 220 return $this->config;
203 } 221 }
222
223 /**
224 * @return bool
225 */
226 public function isTwoFactorAuthentication()
227 {
228 return $this->twoFactorAuthentication;
229 }
230
231 /**
232 * @param bool $twoFactorAuthentication
233 */
234 public function setTwoFactorAuthentication($twoFactorAuthentication)
235 {
236 $this->twoFactorAuthentication = $twoFactorAuthentication;
237 }
238
239 public function isEmailAuthEnabled()
240 {
241 return $this->twoFactorAuthentication;
242 }
243
244 public function getEmailAuthCode()
245 {
246 return $this->authCode;
247 }
248
249 public function setEmailAuthCode($authCode)
250 {
251 $this->authCode = $authCode;
252 }
253
254 public function addTrustedComputer($token, \DateTime $validUntil)
255 {
256 $this->trusted[$token] = $validUntil->format('r');
257 }
258
259 public function isTrustedComputer($token)
260 {
261 if (isset($this->trusted[$token])) {
262 $now = new \DateTime();
263 $validUntil = new \DateTime($this->trusted[$token]);
264
265 return $now < $validUntil;
266 }
267
268 return false;
269 }
204} 270}
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml
index e69de29b..9cdd247d 100644
--- a/src/Wallabag/UserBundle/Resources/config/services.yml
+++ b/src/Wallabag/UserBundle/Resources/config/services.yml
@@ -0,0 +1,19 @@
1parameters:
2 wallabag_user.twofactor.email.provider.class: Wallabag\UserBundle\Security\TwoFactor\Email\Helper
3 wallabag_user.twofactor.email.interactive_login_listener.class: Wallabag\UserBundle\Security\TwoFactor\Email\InteractiveLoginListener
4 wallabag_user.twofactor.email.request_listener.class: Wallabag\UserBundle\Security\TwoFactor\Email\RequestListener
5
6services:
7 wallabag_user.twofactor.email.provider:
8 class: %wallabag_user.twofactor.email.provider.class%
9 arguments: ['@doctrine.orm.entity_manager', '@mailer']
10 wallabag_user.twofactor.email.interactive_login_listener:
11 class: %wallabag_user.twofactor.email.interactive_login_listener.class%
12 tags:
13 - { name: kernel.event_listener, event: security.interactive_login, method: onSecurityInteractiveLogin }
14 arguments: ['@wallabag_user.twofactor.email.provider']
15 wallabag_user.twofactor.email.request_listener:
16 class: %wallabag_user.twofactor.email.request_listener.class%
17 tags:
18 - { name: kernel.event_listener, event: kernel.request, method: onCoreRequest, priority: -1 }
19 arguments: ['@wallabag_user.twofactor.email.provider', '@security.context', '@templating', '@router']
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/baggy/Authentication/form.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Authentication/form.html.twig
new file mode 100644
index 00000000..5bb91081
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/baggy/Authentication/form.html.twig
@@ -0,0 +1,32 @@
1{% extends "WallabagUserBundle::layout.html.twig" %}
2
3{% block fos_user_content %}
4<form class="form" action="" method="post">
5 <fieldset class="w500p center">
6 {% for flashMessage in app.session.flashbag.get("two_factor") %}
7 <p class="error">{{ flashMessage|trans }}</p>
8 {% endfor %}
9
10 <div class="row">
11 <label for="_auth_code">{{ "scheb_two_factor.auth_code"|trans }}</label>
12 <input id="_auth_code" type="text" autocomplete="off" name="_auth_code" />
13 </div>
14
15 {% if useTrustedOption %}
16 <div class="row">
17 <input id="_trusted" type="checkbox" name="_trusted" />
18 <label for="_trusted">{{ "scheb_two_factor.trusted"|trans }}</label>
19 </div>
20 {% endif %}
21
22 <div class="row mts txtcenter">
23 <a href="{{ path('fos_user_security_logout') }}" class="waves-effect waves-light grey btn"><i class="material-icons left"></i> {% trans %}Cancel{% endtrans %}</a>
24 <button type="submit" name="send">
25 {{ "scheb_two_factor.login"|trans }}
26 <i class="mdi-content-send right"></i>
27 </button>
28 </div>
29 </fieldset>
30
31</form>
32{% endblock %}
diff --git a/src/Wallabag/UserBundle/Resources/views/themes/material/Authentication/form.html.twig b/src/Wallabag/UserBundle/Resources/views/themes/material/Authentication/form.html.twig
new file mode 100644
index 00000000..fa0e3dc1
--- /dev/null
+++ b/src/Wallabag/UserBundle/Resources/views/themes/material/Authentication/form.html.twig
@@ -0,0 +1,33 @@
1{% extends "WallabagUserBundle::layout.html.twig" %}
2
3{% block fos_user_content %}
4<form class="form" action="" method="post">
5 <div class="card-content">
6 <div class="row">
7
8 {% for flashMessage in app.session.flashbag.get("two_factor") %}
9 <p class="error">{{ flashMessage|trans }}</p>
10 {% endfor %}
11
12 <div class="input-field col s12">
13 <label for="_auth_code">{{ "scheb_two_factor.auth_code"|trans }}</label>
14 <input id="_auth_code" type="text" autocomplete="off" name="_auth_code" />
15 </div>
16
17 {% if useTrustedOption %}
18 <div class="input-field col s12">
19 <input id="_trusted" type="checkbox" name="_trusted" />
20 <label for="_trusted">{{ "scheb_two_factor.trusted"|trans }}</label>
21 </div>
22 {% endif %}
23 </div>
24 </div>
25 <div class="card-action center">
26 <a href="{{ path('fos_user_security_logout') }}" class="waves-effect waves-light grey btn"><i class="material-icons left"></i> {% trans %}Cancel{% endtrans %}</a>
27 <button class="btn waves-effect waves-light" type="submit" name="send">
28 {{ "scheb_two_factor.login"|trans }}
29 <i class="mdi-content-send right"></i>
30 </button>
31 </div>
32</form>
33{% endblock %}