From bcce7bc88efae98961ba76e3275a5eb995a07d36 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 6 Aug 2021 15:20:28 +0545 Subject: [PATCH] drop custom id support on sessions --- app/controllers/api/account.php | 5 ++--- app/views/home/auth/signin.phtml | 2 -- tests/e2e/Scopes/Scope.php | 2 -- tests/e2e/Services/Account/AccountBase.php | 8 -------- tests/e2e/Services/Account/AccountCustomClientTest.php | 4 ---- tests/e2e/Services/Projects/ProjectsConsoleClientTest.php | 2 -- tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php | 5 ----- 7 files changed, 2 insertions(+), 26 deletions(-) diff --git a/app/controllers/api/account.php b/app/controllers/api/account.php index 65cf24f95e..a067ea6db4 100644 --- a/app/controllers/api/account.php +++ b/app/controllers/api/account.php @@ -139,7 +139,6 @@ App::post('/v1/account/sessions') ->label('sdk.response.model', Response::MODEL_SESSION) ->label('abuse-limit', 10) ->label('abuse-key', 'url:{url},email:{param-email}') - ->param('sessionId', '', new CustomId(), 'Unique Id. Choose your own unique ID or pass the string `unique()` to auto generate it. Valid chars are a-z, A-Z, 0-9, and underscore. Can\'t start with a leading underscore. Max length is 36 chars.') ->param('email', '', new Email(), 'User email.') ->param('password', '', new Password(), 'User password. Must be between 6 to 32 chars.') ->inject('request') @@ -148,7 +147,7 @@ App::post('/v1/account/sessions') ->inject('locale') ->inject('geodb') ->inject('audits') - ->action(function ($sessionId, $email, $password, $request, $response, $dbForInternal, $locale, $geodb, $audits) { + ->action(function ($email, $password, $request, $response, $dbForInternal, $locale, $geodb, $audits) { /** @var Utopia\Swoole\Request $request */ /** @var Appwrite\Utopia\Response $response */ /** @var Utopia\Database\Database $dbForInternal */ @@ -181,7 +180,7 @@ App::post('/v1/account/sessions') $secret = Auth::tokenGenerator(); $session = new Document(array_merge( [ - '$id' => $sessionId == 'unique()' ? $dbForInternal->getId() : $sessionId, + '$id' => $dbForInternal->getId(), 'userId' => $profile->getId(), 'provider' => Auth::SESSION_PROVIDER_EMAIL, 'providerUid' => $email, diff --git a/app/views/home/auth/signin.phtml b/app/views/home/auth/signin.phtml index b096654a1d..fc21da1de8 100644 --- a/app/views/home/auth/signin.phtml +++ b/app/views/home/auth/signin.phtml @@ -34,8 +34,6 @@ $root = ($this->getParam('root') !== 'disabled'); data-failure="alert" data-failure-param-alert-text="Login failed. Please check your credentials." data-failure-param-alert-classname="error"> - - diff --git a/tests/e2e/Scopes/Scope.php b/tests/e2e/Scopes/Scope.php index 71cbd3885a..01673ab7e7 100644 --- a/tests/e2e/Scopes/Scope.php +++ b/tests/e2e/Scopes/Scope.php @@ -100,7 +100,6 @@ abstract class Scope extends TestCase 'content-type' => 'application/json', 'x-appwrite-project' => 'console', ], [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -153,7 +152,6 @@ abstract class Scope extends TestCase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ], [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); diff --git a/tests/e2e/Services/Account/AccountBase.php b/tests/e2e/Services/Account/AccountBase.php index a6681d3391..090c903515 100644 --- a/tests/e2e/Services/Account/AccountBase.php +++ b/tests/e2e/Services/Account/AccountBase.php @@ -111,7 +111,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -129,7 +128,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email.'x', 'password' => $password, ]); @@ -141,7 +139,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password.'x', ]); @@ -153,7 +150,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => '', 'password' => '', ]); @@ -491,7 +487,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => 'new-password', ]); @@ -855,7 +850,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -923,7 +917,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -1006,7 +999,6 @@ trait AccountBase 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); diff --git a/tests/e2e/Services/Account/AccountCustomClientTest.php b/tests/e2e/Services/Account/AccountCustomClientTest.php index e7d866849d..8fe31421e8 100644 --- a/tests/e2e/Services/Account/AccountCustomClientTest.php +++ b/tests/e2e/Services/Account/AccountCustomClientTest.php @@ -83,7 +83,6 @@ class AccountCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -126,7 +125,6 @@ class AccountCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -165,7 +163,6 @@ class AccountCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -374,7 +371,6 @@ class AccountCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); diff --git a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php index b2d1af886f..933b3e1e9c 100644 --- a/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php +++ b/tests/e2e/Services/Projects/ProjectsConsoleClientTest.php @@ -331,7 +331,6 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $id, ]), [ - 'sessionId' => 'unique()', 'email' => $originalEmail, 'password' => $originalPassword, ]); @@ -421,7 +420,6 @@ class ProjectsConsoleClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $id, ]), [ - 'sessionId' => 'unique()', 'email' => $originalEmail, 'password' => $originalPassword, ]); diff --git a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php index 2786d2c82d..400b28b229 100644 --- a/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php +++ b/tests/e2e/Services/Webhooks/WebhooksCustomClientTest.php @@ -89,7 +89,6 @@ class WebhooksCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -146,7 +145,6 @@ class WebhooksCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -213,7 +211,6 @@ class WebhooksCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -286,7 +283,6 @@ class WebhooksCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]); @@ -345,7 +341,6 @@ class WebhooksCustomClientTest extends Scope 'content-type' => 'application/json', 'x-appwrite-project' => $this->getProject()['$id'], ]), [ - 'sessionId' => 'unique()', 'email' => $email, 'password' => $password, ]);