remove password required for project deletion
This commit is contained in:
parent
181741d7a2
commit
6813d53e06
2 changed files with 3 additions and 11 deletions
|
@ -684,17 +684,11 @@ App::delete('/v1/projects/:projectId')
|
|||
->label('sdk.response.code', Response::STATUS_CODE_NOCONTENT)
|
||||
->label('sdk.response.model', Response::MODEL_NONE)
|
||||
->param('projectId', '', new UID(), 'Project unique ID.')
|
||||
->param('password', '', new Password(), 'Your user password for confirmation. Must be at least 8 chars.')
|
||||
->inject('response')
|
||||
->inject('user')
|
||||
->inject('dbForConsole')
|
||||
->inject('deletes')
|
||||
->action(function (string $projectId, string $password, Response $response, Document $user, Database $dbForConsole, Delete $deletes) {
|
||||
|
||||
if (!Auth::passwordVerify($password, $user->getAttribute('password'), $user->getAttribute('hash'), $user->getAttribute('hashOptions'))) { // Double check user password
|
||||
throw new Exception(Exception::USER_INVALID_CREDENTIALS);
|
||||
}
|
||||
|
||||
$project = $dbForConsole->getDocument('projects', $projectId);
|
||||
|
||||
if ($project->isEmpty()) {
|
||||
|
|
|
@ -2997,15 +2997,13 @@ class ProjectsConsoleClientTest extends Scope
|
|||
|
||||
$this->assertEquals(200, $project['headers']['status-code']);
|
||||
|
||||
// Delete team
|
||||
// Delete Project
|
||||
$team = $this->client->call(Client::METHOD_DELETE, '/projects/' . $projectId, array_merge([
|
||||
'content-type' => 'application/json',
|
||||
'x-appwrite-project' => $this->getProject()['$id'],
|
||||
], $this->getHeaders()), [
|
||||
'password' => 'password'
|
||||
]);
|
||||
], $this->getHeaders()));
|
||||
|
||||
$this->assertEquals(204, $team['headers']['status-code']);
|
||||
$this->assertEquals(204, $project['headers']['status-code']);
|
||||
|
||||
// Ensure I can get team but not a project
|
||||
$team = $this->client->call(Client::METHOD_GET, '/teams/' . $teamId, array_merge([
|
||||
|
|
Loading…
Reference in a new issue