From eb039eb90c817c0031e283331389ca756ed80aed Mon Sep 17 00:00:00 2001 From: Rhilip Date: Mon, 12 Aug 2019 15:11:39 +0800 Subject: [PATCH] build(Validator): Upgrade siriusphp/validation to 2.3 with new build-in validation rule (https://github.com/siriusphp/validation/pull/61), We can easily check if The password matches username. --- CHANGELOG.md | 1 + apps/models/form/Auth/UserRegisterForm.php | 3 +- composer.json | 2 +- composer.lock | 38 +++++++++++----------- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d6d3b75..6eb47a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Feat - **Auth:** Use JWT to set cookies content (bf897c6) - **Auth/Login:** Add full Advanced Options support (6009dc8) +- **Secret:** Check session and user_id match or not in jwt payload (358ba5d) - **Secret:** Protect jwt key for env('APP_SECRET_KEY') (dfa67da) - **ban_ips:** Store banned ip in components/Site (01084c9) diff --git a/apps/models/form/Auth/UserRegisterForm.php b/apps/models/form/Auth/UserRegisterForm.php index 005c4eb..11faf1a 100644 --- a/apps/models/form/Auth/UserRegisterForm.php +++ b/apps/models/form/Auth/UserRegisterForm.php @@ -67,9 +67,10 @@ public static function inputRules() ['required'], ['MaxLength', ['max' => 12], 'User name is too log, Max length {max}'] ], - 'password' => [ // TODO The password cannot match your username. ( make change to validator library + 'password' => [ ['required'], ['length', '6,40'], + ['NotMatch', ['item' => 'username']] ], 'password_again' => [ ['required'], diff --git a/composer.json b/composer.json index ca47856..a5c0605 100644 --- a/composer.json +++ b/composer.json @@ -33,7 +33,7 @@ "league/plates": "^3.3", "mjohnson/decoda": "^6.12", "phpmailer/phpmailer": "^6.0", - "siriusphp/validation": "^2.2", + "siriusphp/validation": "^2.3", "soundasleep/html2text": "^1.1", "robthree/twofactorauth": "^1.6", "firebase/php-jwt": "^5.0" diff --git a/composer.lock b/composer.lock index fc494da..7ad8d54 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8610af97db6a716b46a2b048c9e7f552", + "content-hash": "161772be41e2eddc3783c36c034a7638", "packages": [ { "name": "firebase/php-jwt", @@ -306,16 +306,16 @@ }, { "name": "robthree/twofactorauth", - "version": "1.6.6", + "version": "1.6.7", "source": { "type": "git", "url": "https://github.com/RobThree/TwoFactorAuth.git", - "reference": "7477d5d65625b7fe33cb338b98e419d394e9e9fd" + "reference": "3407c33775391fa8c36f7d766f26c5e59a736374" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/7477d5d65625b7fe33cb338b98e419d394e9e9fd", - "reference": "7477d5d65625b7fe33cb338b98e419d394e9e9fd", + "url": "https://api.github.com/repos/RobThree/TwoFactorAuth/zipball/3407c33775391fa8c36f7d766f26c5e59a736374", + "reference": "3407c33775391fa8c36f7d766f26c5e59a736374", "shasum": "", "mirrors": [ { @@ -343,8 +343,8 @@ "authors": [ { "name": "Rob Janssen", - "homepage": "http://robiii.me", - "role": "Developer" + "role": "Developer", + "homepage": "http://robiii.me" } ], "description": "Two Factor Authentication", @@ -359,20 +359,20 @@ "php", "tfa" ], - "time": "2019-03-19T21:51:19+00:00" + "time": "2019-06-21T08:51:04+00:00" }, { "name": "siriusphp/validation", - "version": "2.2.3", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/siriusphp/validation.git", - "reference": "3c601f2f1bd3997fc6f5695f1564ce6e6c077c25" + "reference": "fa93b302802616b1dcf7e38244a70e324c121fb4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/siriusphp/validation/zipball/3c601f2f1bd3997fc6f5695f1564ce6e6c077c25", - "reference": "3c601f2f1bd3997fc6f5695f1564ce6e6c077c25", + "url": "https://api.github.com/repos/siriusphp/validation/zipball/fa93b302802616b1dcf7e38244a70e324c121fb4", + "reference": "fa93b302802616b1dcf7e38244a70e324c121fb4", "shasum": "", "mirrors": [ { @@ -385,7 +385,7 @@ "php": ">=5.3" }, "require-dev": { - "phpunit/phpunit": "^3.7" + "phpunit/phpunit": "^4.8" }, "type": "library", "autoload": { @@ -411,7 +411,7 @@ "security", "validation" ], - "time": "2019-04-03T08:57:10+00:00" + "time": "2019-08-11T13:55:53+00:00" }, { "name": "soundasleep/html2text", @@ -477,16 +477,16 @@ "source": { "type": "git", "url": "https://github.com/wudi/swoole-ide-helper.git", - "reference": "d03e7e2d8ffd12e054555cae6dda8b2b3683d934" + "reference": "fceabb51fca645166fdc3d885bb582eb3352335e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wudi/swoole-ide-helper/zipball/d03e7e2d8ffd12e054555cae6dda8b2b3683d934", - "reference": "d03e7e2d8ffd12e054555cae6dda8b2b3683d934", + "url": "https://api.github.com/repos/wudi/swoole-ide-helper/zipball/fceabb51fca645166fdc3d885bb582eb3352335e", + "reference": "fceabb51fca645166fdc3d885bb582eb3352335e", "shasum": "", "mirrors": [ { - "url": "https://dl.laravel-china.org/%package%/%reference%.%type%", + "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%", "preferred": true } ] @@ -515,7 +515,7 @@ "sublime", "swoole" ], - "time": "2019-04-02T09:53:11+00:00" + "time": "2019-07-18T01:21:48+00:00" } ], "aliases": [],