Merge branch 'master' of https://github.com/appwrite/appwrite into 0.14.x

This commit is contained in:
Torsten Dittmann
2022-04-20 17:00:51 +02:00
6 changed files with 120 additions and 28 deletions
+2 -2
View File
@@ -24,7 +24,7 @@ COPY public /usr/local/src/public
RUN npm ci
RUN npm run build
FROM php:8.0.14-cli-alpine3.15 as compile
FROM php:8.0.18-cli-alpine3.15 as compile
ARG DEBUG=false
ENV DEBUG=$DEBUG
@@ -123,7 +123,7 @@ RUN \
./configure && \
make && make install
FROM php:8.0.14-cli-alpine3.15 as final
FROM php:8.0.18-cli-alpine3.15 as final
LABEL maintainer="team@appwrite.io"
+2 -2
View File
@@ -675,7 +675,7 @@ App::post('/v1/account/sessions/magic-url')
'emailVerification' => false,
'status' => true,
'password' => null,
'passwordUpdate' => \time(),
'passwordUpdate' => 0,
'registration' => \time(),
'reset' => false,
'prefs' => new \stdClass(),
@@ -946,7 +946,7 @@ App::post('/v1/account/sessions/anonymous')
'emailVerification' => false,
'status' => true,
'password' => null,
'passwordUpdate' => \time(),
'passwordUpdate' => 0,
'registration' => \time(),
'reset' => false,
'name' => null,
+2 -2
View File
@@ -267,9 +267,9 @@ $logs = $this->getParam('logs', null);
:required="attr.required"
:name="attr.key"
data-cast-to="string">
<template x-for="element in attr.elements">
<option :disabled="attr.required" selected label=" "></option>
<option :disabled="attr.required" selected label=" "></option>
<template x-for="element in attr.elements">
<option
:value="element"
x-text="element"
Generated
+13 -21
View File
@@ -2250,16 +2250,16 @@
},
{
"name": "utopia-php/framework",
"version": "0.19.8",
"version": "0.19.9",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/framework.git",
"reference": "8c3b3e330546fd6cd65bd1f8d8d08882ff3abb7d"
"reference": "4af9fc866edce1b8cff94731fb26c27599118e87"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/8c3b3e330546fd6cd65bd1f8d8d08882ff3abb7d",
"reference": "8c3b3e330546fd6cd65bd1f8d8d08882ff3abb7d",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/4af9fc866edce1b8cff94731fb26c27599118e87",
"reference": "4af9fc866edce1b8cff94731fb26c27599118e87",
"shasum": ""
},
"require": {
@@ -2293,9 +2293,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/framework/issues",
"source": "https://github.com/utopia-php/framework/tree/0.19.8"
"source": "https://github.com/utopia-php/framework/tree/0.19.9"
},
"time": "2022-04-12T00:28:15+00:00"
"time": "2022-04-14T15:39:47+00:00"
},
{
"name": "utopia-php/image",
@@ -3551,16 +3551,16 @@
},
{
"name": "matthiasmullie/minify",
"version": "1.3.66",
"version": "1.3.67",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/minify.git",
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6"
"reference": "acaee1b7ca3cd67a39d7f98673cacd7e4739a8d9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
"reference": "45fd3b0f1dfa2c965857c6d4a470bea52adc31a6",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/acaee1b7ca3cd67a39d7f98673cacd7e4739a8d9",
"reference": "acaee1b7ca3cd67a39d7f98673cacd7e4739a8d9",
"shasum": ""
},
"require": {
@@ -3609,23 +3609,15 @@
],
"support": {
"issues": "https://github.com/matthiasmullie/minify/issues",
"source": "https://github.com/matthiasmullie/minify/tree/1.3.66"
"source": "https://github.com/matthiasmullie/minify/tree/1.3.67"
},
"funding": [
{
"url": "https://github.com/[user1",
"type": "github"
},
{
"url": "https://github.com/matthiasmullie] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g.",
"type": "github"
},
{
"url": "https://github.com/user2",
"url": "https://github.com/matthiasmullie",
"type": "github"
}
],
"time": "2021-01-06T15:18:10+00:00"
"time": "2022-03-24T08:54:59+00:00"
},
{
"name": "matthiasmullie/path-converter",
+1 -1
View File
@@ -1 +1 @@
Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth and Team Invites, oldPassword is optional.
Update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
+100
View File
@@ -1327,6 +1327,7 @@ trait AccountBase
$data['token'] = $token;
$data['id'] = $userId;
$data['email'] = $email;
return $data;
}
@@ -1357,6 +1358,9 @@ trait AccountBase
$this->assertNotEmpty($response['body']['$id']);
$this->assertNotEmpty($response['body']['userId']);
$sessionId = $response['body']['$id'];
$session = $this->client->parseCookie((string)$response['headers']['set-cookie'])['a_session_'.$this->getProject()['$id']];
/**
* Test for FAILURE
*/
@@ -1382,6 +1386,102 @@ trait AccountBase
$this->assertEquals(401, $response['headers']['status-code']);
$data['sessionId'] = $sessionId;
$data['session'] = $session;
return $data;
}
/**
* @depends testCreateSessionWithMagicUrl
*/
public function testUpdateAccountPasswordWithMagicUrl($data):array
{
$email = $data['email'] ?? '';
$session = $data['session'] ?? '';
/**
* Test for SUCCESS
*/
$response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [
'password' => 'new-password'
]);
$this->assertEquals($response['headers']['status-code'], 200);
$this->assertIsArray($response['body']);
$this->assertNotEmpty($response['body']);
$this->assertNotEmpty($response['body']['$id']);
$this->assertIsNumeric($response['body']['registration']);
$this->assertEquals($response['body']['email'], $email);
$response = $this->client->call(Client::METHOD_POST, '/account/sessions', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]), [
'email' => $email,
'password' => 'new-password',
]);
$this->assertEquals($response['headers']['status-code'], 201);
/**
* Test for FAILURE
*/
$response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
]));
$this->assertEquals($response['headers']['status-code'], 401);
$response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [
]);
$this->assertEquals($response['headers']['status-code'], 400);
/**
* Existing user tries to update password by passing wrong old password -> SHOULD FAIL
*/
$response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [
'password' => 'new-password',
'oldPassword' => 'wrong-password',
]);
$this->assertEquals($response['headers']['status-code'], 401);
/**
* Existing user tries to update password without passing old password -> SHOULD FAIL
*/
$response = $this->client->call(Client::METHOD_PATCH, '/account/password', array_merge([
'origin' => 'http://localhost',
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
'cookie' => 'a_session_'.$this->getProject()['$id'].'=' . $session,
]), [
'password' => 'new-password'
]);
$this->assertEquals($response['headers']['status-code'], 401);
$data['password'] = 'new-password';
return $data;
}
}