1
0
Fork 0
mirror of synced 2024-07-03 21:50:34 +12:00

Reviews fixes

This commit is contained in:
Jake Barnby 2023-04-12 03:32:14 +12:00
parent f869252d90
commit d86d604624
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C
4 changed files with 6 additions and 11 deletions

View file

@ -417,10 +417,10 @@ App::post('/v1/teams/:teamId/memberships')
if ($invitee->isEmpty()) {
throw new Exception(Exception::USER_NOT_FOUND, 'User with given userId doesn\'t exist.', 404);
}
if (!empty($email) && $invitee->getAttribute('email', '') != $email) {
if (!empty($email) && $invitee->getAttribute('email', '') !== $email) {
throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given userId and email doesn\'t match', 409);
}
if (!empty($phone) && $invitee->getAttribute('phone', '') != $phone) {
if (!empty($phone) && $invitee->getAttribute('phone', '') !== $phone) {
throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given userId and phone doesn\'t match', 409);
}
$email = $invitee->getAttribute('email', '');
@ -428,12 +428,12 @@ App::post('/v1/teams/:teamId/memberships')
$name = empty($name) ? $invitee->getAttribute('name', '') : $name;
} elseif (!empty($email)) {
$invitee = $dbForProject->findOne('users', [Query::equal('email', [$email])]); // Get user by email address
if (!empty($invitee) && !empty($phone) && $invitee->getAttribute('phone', '') != $phone) {
if (!empty($invitee) && !empty($phone) && $invitee->getAttribute('phone', '') !== $phone) {
throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given email and phone doesn\'t match', 409);
}
} elseif (!empty($phone)) {
$invitee = $dbForProject->findOne('users', [Query::equal('phone', [$phone])]);
if (!empty($invitee) && !empty($email) && $invitee->getAttribute('email', '') != $email) {
if (!empty($invitee) && !empty($email) && $invitee->getAttribute('email', '') !== $email) {
throw new Exception(Exception::USER_ALREADY_EXISTS, 'Given phone and email doesn\'t match', 409);
}
}

View file

@ -2,8 +2,6 @@
namespace Appwrite\Auth\Validator;
use Utopia\Database\Document;
/**
* Password.
*

View file

@ -12,6 +12,8 @@ use Appwrite\Auth\Auth;
class PasswordHistory extends Password
{
protected array $history;
protected string $algo;
protected array $algoOptions;
public function __construct(array $history, string $algo, array $algoOptions = [])
{

View file

@ -3,11 +3,6 @@
namespace Appwrite\Utopia\Database\Validator\Queries;
use Appwrite\Utopia\Database\Validator\Queries;
use Appwrite\Utopia\Database\Validator\Query\Cursor;
use Appwrite\Utopia\Database\Validator\Query\Filter;
use Appwrite\Utopia\Database\Validator\Query\Limit;
use Appwrite\Utopia\Database\Validator\Query\Offset;
use Appwrite\Utopia\Database\Validator\Query\Order;
use Appwrite\Utopia\Database\Validator\Query\Select;
use Utopia\Database\Database;