From bf14d1d97df23f21241347c2d1a7736e2e393e88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Ba=C4=8Do?= Date: Wed, 10 Jan 2024 15:09:39 +0000 Subject: [PATCH] Add random security phrases --- app/controllers/api/account.php | 3 ++- src/Appwrite/Auth/SecurityPhrase.php | 20 ++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 src/Appwrite/Auth/SecurityPhrase.php diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 48f0584808..fd1e2e5548 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -8,6 +8,7 @@ use Appwrite\Auth\Validator\Phone; use Appwrite\Detector\Detector; use Appwrite\Event\Event; use Appwrite\Event\Mail; +use Appwrite\Auth\SecurityPhrase; use Appwrite\Extend\Exception; use Appwrite\Network\Validator\Email; use Utopia\Validator\Host; @@ -949,7 +950,7 @@ App::post('/v1/account/sessions/magic-url') } if($securityPhrase === true) { - $securityPhrase = 'Golden Fox'; // TODO: Random phrase + $securityPhrase = SecurityPhrase::generate(); } $roles = Authorization::getRoles(); diff --git a/src/Appwrite/Auth/SecurityPhrase.php b/src/Appwrite/Auth/SecurityPhrase.php new file mode 100644 index 0000000000..1ed65bd589 --- /dev/null +++ b/src/Appwrite/Auth/SecurityPhrase.php @@ -0,0 +1,20 @@ +