fix: di
This commit is contained in:
parent
b8e6de7516
commit
cb25d5209e
9 changed files with 29 additions and 24 deletions
|
@ -185,7 +185,7 @@ return [
|
||||||
[
|
[
|
||||||
'key' => 'web',
|
'key' => 'web',
|
||||||
'name' => 'Console',
|
'name' => 'Console',
|
||||||
'version' => '0.3.0',
|
'version' => '0.6.0-rc.2',
|
||||||
'url' => 'https://github.com/appwrite/sdk-for-console',
|
'url' => 'https://github.com/appwrite/sdk-for-console',
|
||||||
'package' => '',
|
'package' => '',
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
|
@ -195,8 +195,8 @@ return [
|
||||||
'family' => APP_PLATFORM_CONSOLE,
|
'family' => APP_PLATFORM_CONSOLE,
|
||||||
'prism' => 'javascript',
|
'prism' => 'javascript',
|
||||||
'source' => \realpath(__DIR__ . '/../sdks/console-web'),
|
'source' => \realpath(__DIR__ . '/../sdks/console-web'),
|
||||||
'gitUrl' => 'git@github.com:appwrite/sdk-for-console.git',
|
'gitUrl' => 'https://github.com/appwrite/sdk-for-console',
|
||||||
'gitBranch' => 'dev',
|
'gitBranch' => '1.5.x',
|
||||||
'gitRepoName' => 'sdk-for-console',
|
'gitRepoName' => 'sdk-for-console',
|
||||||
'gitUserName' => 'appwrite',
|
'gitUserName' => 'appwrite',
|
||||||
],
|
],
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -3216,14 +3216,14 @@ App::patch('/v1/account/mfa')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('user')
|
->inject('user')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('events')
|
->inject('queueForEvents')
|
||||||
->action(function (bool $mfa, ?\DateTime $requestTimestamp, Response $response, Document $user, Database $dbForProject, Event $events) {
|
->action(function (bool $mfa, ?\DateTime $requestTimestamp, Response $response, Document $user, Database $dbForProject, Event $queueForEvents) {
|
||||||
|
|
||||||
$user->setAttribute('mfa', $mfa);
|
$user->setAttribute('mfa', $mfa);
|
||||||
|
|
||||||
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
||||||
|
|
||||||
$events->setParam('userId', $user->getId());
|
$queueForEvents->setParam('userId', $user->getId());
|
||||||
|
|
||||||
$response->dynamic($user, Response::MODEL_ACCOUNT);
|
$response->dynamic($user, Response::MODEL_ACCOUNT);
|
||||||
});
|
});
|
||||||
|
@ -3279,8 +3279,8 @@ App::post('/v1/account/mfa/:provider')
|
||||||
->inject('project')
|
->inject('project')
|
||||||
->inject('user')
|
->inject('user')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('events')
|
->inject('queueForEvents')
|
||||||
->action(function (string $provider, ?\DateTime $requestTimestamp, Response $response, Document $project, Document $user, Database $dbForProject, Event $events) {
|
->action(function (string $provider, ?\DateTime $requestTimestamp, Response $response, Document $project, Document $user, Database $dbForProject, Event $queueForEvents) {
|
||||||
|
|
||||||
$otp = match ($provider) {
|
$otp = match ($provider) {
|
||||||
'totp' => new TOTP(),
|
'totp' => new TOTP(),
|
||||||
|
@ -3313,7 +3313,7 @@ App::post('/v1/account/mfa/:provider')
|
||||||
|
|
||||||
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
||||||
|
|
||||||
$events->setParam('userId', $user->getId());
|
$queueForEvents->setParam('userId', $user->getId());
|
||||||
|
|
||||||
$response->dynamic($model, Response::MODEL_MFA_PROVIDER);
|
$response->dynamic($model, Response::MODEL_MFA_PROVIDER);
|
||||||
});
|
});
|
||||||
|
@ -3340,11 +3340,10 @@ App::put('/v1/account/mfa/:provider')
|
||||||
->param('otp', '', new Text(256), 'Valid verification token.')
|
->param('otp', '', new Text(256), 'Valid verification token.')
|
||||||
->inject('requestTimestamp')
|
->inject('requestTimestamp')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('project')
|
|
||||||
->inject('user')
|
->inject('user')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('events')
|
->inject('queueForEvents')
|
||||||
->action(function (string $provider, string $otp, ?\DateTime $requestTimestamp, Response $response, Document $project, Document $user, Database $dbForProject, Event $events) {
|
->action(function (string $provider, string $otp, ?\DateTime $requestTimestamp, Response $response, Document $user, Database $dbForProject, Event $queueForEvents) {
|
||||||
|
|
||||||
$success = match ($provider) {
|
$success = match ($provider) {
|
||||||
'totp' => Challenge\TOTP::verify($user, $otp),
|
'totp' => Challenge\TOTP::verify($user, $otp),
|
||||||
|
@ -3368,7 +3367,7 @@ App::put('/v1/account/mfa/:provider')
|
||||||
|
|
||||||
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
$user = $dbForProject->withRequestTimestamp($requestTimestamp, fn () => $dbForProject->updateDocument('users', $user->getId(), $user));
|
||||||
|
|
||||||
$events->setParam('userId', $user->getId());
|
$queueForEvents->setParam('userId', $user->getId());
|
||||||
|
|
||||||
$response->dynamic($user, Response::MODEL_ACCOUNT);
|
$response->dynamic($user, Response::MODEL_ACCOUNT);
|
||||||
});
|
});
|
||||||
|
@ -3396,11 +3395,11 @@ App::post('/v1/account/mfa/challenge')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('user')
|
->inject('user')
|
||||||
->inject('project')
|
->inject('project')
|
||||||
->inject('events')
|
->inject('queueForEvents')
|
||||||
->inject('messaging')
|
->inject('messaging')
|
||||||
->inject('mails')
|
->inject('mails')
|
||||||
->inject('locale')
|
->inject('locale')
|
||||||
->action(function (string $provider, Response $response, Database $dbForProject, Document $user, Document $project, Event $events, EventPhone $messaging, Mail $mails, Locale $locale) {
|
->action(function (string $provider, Response $response, Database $dbForProject, Document $user, Document $project, Event $queueForEvents, EventPhone $messaging, Mail $mails, Locale $locale) {
|
||||||
|
|
||||||
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
$expire = DateTime::addSeconds(new \DateTime(), Auth::TOKEN_EXPIRATION_CONFIRM);
|
||||||
$challenge = new Document([
|
$challenge = new Document([
|
||||||
|
@ -3461,7 +3460,7 @@ App::post('/v1/account/mfa/challenge')
|
||||||
|
|
||||||
$challenge = $dbForProject->createDocument('challenges', $challenge);
|
$challenge = $dbForProject->createDocument('challenges', $challenge);
|
||||||
|
|
||||||
$events
|
$queueForEvents
|
||||||
->setParam('userId', $user->getId())
|
->setParam('userId', $user->getId())
|
||||||
->setParam('challengeId', $challenge->getId());
|
->setParam('challengeId', $challenge->getId());
|
||||||
|
|
||||||
|
@ -3491,8 +3490,8 @@ App::put('/v1/account/mfa/challenge')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('user')
|
->inject('user')
|
||||||
->inject('dbForProject')
|
->inject('dbForProject')
|
||||||
->inject('events')
|
->inject('queueForEvents')
|
||||||
->action(function (string $challengeId, string $otp, Document $project, Response $response, Document $user, Database $dbForProject, Event $events) {
|
->action(function (string $challengeId, string $otp, Document $project, Response $response, Document $user, Database $dbForProject, Event $queueForEvents) {
|
||||||
|
|
||||||
$challenge = $dbForProject->getDocument('challenges', $challengeId);
|
$challenge = $dbForProject->getDocument('challenges', $challengeId);
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,12 @@ class User extends Model
|
||||||
'default' => false,
|
'default' => false,
|
||||||
'example' => true,
|
'example' => true,
|
||||||
])
|
])
|
||||||
|
->addRule('mfa', [
|
||||||
|
'type' => self::TYPE_BOOLEAN,
|
||||||
|
'description' => 'Multi factor authentication status.',
|
||||||
|
'default' => false,
|
||||||
|
'example' => true,
|
||||||
|
])
|
||||||
->addRule('prefs', [
|
->addRule('prefs', [
|
||||||
'type' => Response::MODEL_PREFERENCES,
|
'type' => Response::MODEL_PREFERENCES,
|
||||||
'description' => 'User preferences as a key-value object',
|
'description' => 'User preferences as a key-value object',
|
||||||
|
|
Loading…
Reference in a new issue