From 9121e14a8e6f4bb6bc9b8cdd39a075aa6f9054a4 Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 13:55:10 +0300 Subject: [PATCH 01/10] alexgeno/phone-verification-bundle/1.0 receipt --- .../alex_geno_phone_verification.yaml | 19 +++++++++++++++++++ .../1.0/manifest.json | 19 +++++++++++++++++++ .../1.0/post-install.txt | 9 +++++++++ 3 files changed, 47 insertions(+) create mode 100644 alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml create mode 100644 alexgeno/phone-verification-bundle/1.0/manifest.json create mode 100644 alexgeno/phone-verification-bundle/1.0/post-install.txt diff --git a/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml b/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml new file mode 100644 index 000000000..b92a29cee --- /dev/null +++ b/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml @@ -0,0 +1,19 @@ +alex_geno_phone_verification: + storage: + driver: redis # redis || mongodb + redis: + connection: default + mongodb: + connection: default + sender: + transport: vonage + manager: + otp: + length: '%env(int:PHONE_VERIFICATION_OTP_LENGTH)%' + rate_limits: + initiate: #for every 'to' no more than 'count' initiations over 'period_secs' seconds + period_secs: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_INITIATE_PERIOD_SECS)%' + count: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT)%' + complete: #for every 'to' no more than 'count' failed completions over 'period_secs' seconds + period_secs: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS)%' # this is also the expiration period for OTP + count: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT)%' \ No newline at end of file diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json new file mode 100644 index 000000000..4fad582f8 --- /dev/null +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -0,0 +1,19 @@ +{ + "bundles": { + "Snc\\RedisBundle\\SncRedisBundle": ["all"] + }, + "copy-from-recipe": { + "config/": "%CONFIG_DIR%/" + }, + "env": { + "#1": "1000..9999", + "#2": "for every 'to' no more than 10 initiations over 24 hours", + "#4": "for every 'to' no more than 5 failed completions over 5 minutes", + "#5": "this is also the expiration period for OTP", + "PHONE_VERIFICATION_OTP_LENGTH": "4", + "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_PERIOD_SECS": "86400", + "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT": "10", + "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS": "300", + "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT": "5" + } +} \ No newline at end of file diff --git a/alexgeno/phone-verification-bundle/1.0/post-install.txt b/alexgeno/phone-verification-bundle/1.0/post-install.txt new file mode 100644 index 000000000..9d7d26c2a --- /dev/null +++ b/alexgeno/phone-verification-bundle/1.0/post-install.txt @@ -0,0 +1,9 @@ + + What's next? + + + * Run the bundle: + 1. Change a storage driver and sender transport if you need to + 2. Install the respective packages; + + * Read the documentation at https://github.com/alexeygeno/phone-verification-bundle/blob/master/README.md \ No newline at end of file From b62542f78f6fa069ecf6e4d999d2085688ef9c6d Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 15:16:37 +0300 Subject: [PATCH 02/10] Delete post-install.txt --- alexgeno/phone-verification-bundle/1.0/post-install.txt | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 alexgeno/phone-verification-bundle/1.0/post-install.txt diff --git a/alexgeno/phone-verification-bundle/1.0/post-install.txt b/alexgeno/phone-verification-bundle/1.0/post-install.txt deleted file mode 100644 index 9d7d26c2a..000000000 --- a/alexgeno/phone-verification-bundle/1.0/post-install.txt +++ /dev/null @@ -1,9 +0,0 @@ - - What's next? - - - * Run the bundle: - 1. Change a storage driver and sender transport if you need to - 2. Install the respective packages; - - * Read the documentation at https://github.com/alexeygeno/phone-verification-bundle/blob/master/README.md \ No newline at end of file From 8eb7b084b3fdde1bf8802a3feaf7b6ebd12e14ad Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 15:27:57 +0300 Subject: [PATCH 03/10] Fix check error: Text files should end with a newline --- .../1.0/config/packages/alex_geno_phone_verification.yaml | 2 +- alexgeno/phone-verification-bundle/1.0/manifest.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml b/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml index b92a29cee..3999703ef 100644 --- a/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml +++ b/alexgeno/phone-verification-bundle/1.0/config/packages/alex_geno_phone_verification.yaml @@ -16,4 +16,4 @@ alex_geno_phone_verification: count: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT)%' complete: #for every 'to' no more than 'count' failed completions over 'period_secs' seconds period_secs: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS)%' # this is also the expiration period for OTP - count: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT)%' \ No newline at end of file + count: '%env(int:PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT)%' diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json index 4fad582f8..579afd83f 100644 --- a/alexgeno/phone-verification-bundle/1.0/manifest.json +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -16,4 +16,4 @@ "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS": "300", "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT": "5" } -} \ No newline at end of file +} From 5774705441f61746a8652be1259e16f6d2025b18 Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 15:34:06 +0300 Subject: [PATCH 04/10] Fix check error: Wrong bundle name --- alexgeno/phone-verification-bundle/1.0/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json index 579afd83f..52ae082f9 100644 --- a/alexgeno/phone-verification-bundle/1.0/manifest.json +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -1,6 +1,6 @@ { "bundles": { - "Snc\\RedisBundle\\SncRedisBundle": ["all"] + "AlexGeno\\PhoneVerificationBundle\\AlexGenoPhoneVerificationBundle": ["all"] }, "copy-from-recipe": { "config/": "%CONFIG_DIR%/" From e12aa71095de6c090deb2b474aa188b4e85d5651 Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 17:19:08 +0300 Subject: [PATCH 05/10] Manifest.json improvements --- alexgeno/phone-verification-bundle/1.0/manifest.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json index 52ae082f9..63b6acdc1 100644 --- a/alexgeno/phone-verification-bundle/1.0/manifest.json +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -6,13 +6,12 @@ "config/": "%CONFIG_DIR%/" }, "env": { - "#1": "1000..9999", - "#2": "for every 'to' no more than 10 initiations over 24 hours", - "#4": "for every 'to' no more than 5 failed completions over 5 minutes", - "#5": "this is also the expiration period for OTP", - "PHONE_VERIFICATION_OTP_LENGTH": "4", + "#0": "1000..9999", + "PHONE_VERIFICATION_OTP_LENGTH": "4 #\"1000..9999\"", + "#1": "for every 'to' no more than 10 initiations over 24 hours", "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_PERIOD_SECS": "86400", "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT": "10", + "#2": "for every 'to' no more than 5 failed completions over 5 minutes", "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS": "300", "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT": "5" } From f76a5f3a9b89487fb6a414d02fc702ebb1f9ab96 Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 17:33:34 +0300 Subject: [PATCH 06/10] Manifest.json improvements --- alexgeno/phone-verification-bundle/1.0/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json index 63b6acdc1..9696e511b 100644 --- a/alexgeno/phone-verification-bundle/1.0/manifest.json +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -7,7 +7,7 @@ }, "env": { "#0": "1000..9999", - "PHONE_VERIFICATION_OTP_LENGTH": "4 #\"1000..9999\"", + "PHONE_VERIFICATION_OTP_LENGTH": "4", "#1": "for every 'to' no more than 10 initiations over 24 hours", "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_PERIOD_SECS": "86400", "PHONE_VERIFICATION_RATE_LIMIT_INITIATE_COUNT": "10", From 6525734efa080c89b0dfdae382108b7daaf635de Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 20:22:27 +0300 Subject: [PATCH 07/10] Modify packages/snc_redis.yaml to set default redis connection --- alexgeno/phone-verification-bundle/1.0/manifest.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json index 9696e511b..d513e298b 100644 --- a/alexgeno/phone-verification-bundle/1.0/manifest.json +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -14,5 +14,14 @@ "#2": "for every 'to' no more than 5 failed completions over 5 minutes", "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_PERIOD_SECS": "300", "PHONE_VERIFICATION_RATE_LIMIT_COMPLETE_COUNT": "5" - } + }, + "add-lines": [ + { + "file": "config/packages/snc_redis.yaml", + "position": "after_target", + "warn_if_missing": true, + "target": " clients:", + "content": " default:\n type: predis\n alias: default\n dsn: \"%env(REDIS_URL)%\"" + } + ] } From 289ed4039e2526df03df86956175e09be34a6d99 Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 20:31:02 +0300 Subject: [PATCH 08/10] Modify packages/snc_redis.yaml to set default redis connection --- alexgeno/phone-verification-bundle/1.0/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alexgeno/phone-verification-bundle/1.0/manifest.json b/alexgeno/phone-verification-bundle/1.0/manifest.json index d513e298b..de95a00bd 100644 --- a/alexgeno/phone-verification-bundle/1.0/manifest.json +++ b/alexgeno/phone-verification-bundle/1.0/manifest.json @@ -21,7 +21,7 @@ "position": "after_target", "warn_if_missing": true, "target": " clients:", - "content": " default:\n type: predis\n alias: default\n dsn: \"%env(REDIS_URL)%\"" + "content": " default:\n type: predis\n alias: default\n dsn: \"%env(REDIS_URL)%\"" } ] } From 6c0e433cdd2bb242475b83375d960fbd9abd00dc Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 22:19:17 +0300 Subject: [PATCH 09/10] Add routes --- .../1.0/config/routes/phone_verification.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 alexgeno/phone-verification-bundle/1.0/config/routes/phone_verification.yaml diff --git a/alexgeno/phone-verification-bundle/1.0/config/routes/phone_verification.yaml b/alexgeno/phone-verification-bundle/1.0/config/routes/phone_verification.yaml new file mode 100644 index 000000000..4b6c30d07 --- /dev/null +++ b/alexgeno/phone-verification-bundle/1.0/config/routes/phone_verification.yaml @@ -0,0 +1,8 @@ +phone_verification_initiate: + path: /phone-verification/initiate/{to} + controller: AlexGeno\PhoneVerificationBundle\Controller\PhoneVerificationController::initiate + methods: POST +phone_verification_complete: + path: /phone-verification/complete/{to}/{otp} + controller: AlexGeno\PhoneVerificationBundle\Controller\PhoneVerificationController::complete + methods: POST From 174580ef458d21d08ee5a7b76ee4689bc98522c0 Mon Sep 17 00:00:00 2001 From: s1uggard Date: Thu, 14 Sep 2023 22:33:03 +0300 Subject: [PATCH 10/10] Add routes --- ...{phone_verification.yaml => alex_geno_phone_verification.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename alexgeno/phone-verification-bundle/1.0/config/routes/{phone_verification.yaml => alex_geno_phone_verification.yaml} (100%) diff --git a/alexgeno/phone-verification-bundle/1.0/config/routes/phone_verification.yaml b/alexgeno/phone-verification-bundle/1.0/config/routes/alex_geno_phone_verification.yaml similarity index 100% rename from alexgeno/phone-verification-bundle/1.0/config/routes/phone_verification.yaml rename to alexgeno/phone-verification-bundle/1.0/config/routes/alex_geno_phone_verification.yaml