From 6c9ae9a4d2b8ff73689b6b8afc5c0e7fc403cd2f Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 15 Apr 2023 13:58:29 +0400 Subject: [PATCH 1/7] feat: add password personal data check --- .../auth/security/+page.svelte | 2 + .../updatePasswordPersonalData.svelte | 62 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte diff --git a/src/routes/console/project-[project]/auth/security/+page.svelte b/src/routes/console/project-[project]/auth/security/+page.svelte index c9c4119104..477deb0f13 100644 --- a/src/routes/console/project-[project]/auth/security/+page.svelte +++ b/src/routes/console/project-[project]/auth/security/+page.svelte @@ -2,6 +2,7 @@ import { Container } from '$lib/layout'; import UpdatePasswordDictionary from './updatePasswordDictionary.svelte'; import UpdatePasswordHistory from './updatePasswordHistory.svelte'; + import UpdatePasswordPersonalData from './updatePasswordPersonalData.svelte'; import UpdateSessionLength from './updateSessionLength.svelte'; import UpdateSessionsLimit from './updateSessionsLimit.svelte'; import UpdateUsersLimit from './updateUsersLimit.svelte'; @@ -13,4 +14,5 @@ + diff --git a/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte b/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte new file mode 100644 index 0000000000..de1bfab900 --- /dev/null +++ b/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte @@ -0,0 +1,62 @@ + From d77cc751fe8f6a3c46fda8ee54e31126ebf16e30 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Sat, 15 Apr 2023 14:18:02 +0400 Subject: [PATCH 2/7] feat: add password personal data check --- package-lock.json | 9 +++--- package.json | 2 +- src/lib/actions/analytics.ts | 1 + .../security/updatePasswordHistory.svelte | 2 +- .../updatePasswordPersonalData.svelte | 30 ++++++++----------- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/package-lock.json b/package-lock.json index 46a8434389..2d242e6edb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "@appwrite/console", "dependencies": { "@analytics/google-analytics": "^1.0.5", - "@appwrite.io/console": "0.1.0", + "@appwrite.io/console": "npm:christy-appwrite-console@0.0.5", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", @@ -147,9 +147,10 @@ "integrity": "sha512-1Yw7u/COtxx06BfwlI+kVhsa/upKYzmCNrT4c8QDeCY2KMYlnijkUjtHiPU08HxyTIVB5j6d75O0YWVIHwQS8g==" }, "node_modules/@appwrite.io/console": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.1.0.tgz", - "integrity": "sha512-GzCRUmaXAVgpGwxBNI3PrtCLHz7CM+epBHDDTHw8B2u61KbijGBO3GrwreXy91fy00RJiEzGlMSRzDgwsF3Tsg==", + "name": "christy-appwrite-console", + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/christy-appwrite-console/-/christy-appwrite-console-0.0.5.tgz", + "integrity": "sha512-9OHfJW1Tys4xeJh/p3kzNb92oqDT3zrz6Iu8ob6maKupyhb5ghWIa1ev0bowiYvJTDGkNVfDVXXHoXYbBbrmmQ==", "dependencies": { "cross-fetch": "3.1.5", "isomorphic-form-data": "2.0.0" diff --git a/package.json b/package.json index 0e7ec8d6e1..f25008dc86 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@analytics/google-analytics": "^1.0.5", - "@appwrite.io/console": "0.1.0", + "@appwrite.io/console": "npm:christy-appwrite-console@0.0.5", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 84c178cc46..066eb70090 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -143,6 +143,7 @@ export enum Submit { AuthStatusUpdate = 'submit_auth_status_update', AuthPasswordHistoryUpdate = 'submit_auth_password_history_limit_update', AuthPasswordDictionaryUpdate = 'submit_auth_password_dictionary_update', + AuthDisallowPersonalDataUpdate = 'submit_auth_disallow_personal_data_update', SessionsLengthUpdate = 'submit_sessions_length_update', SessionsLimitUpdate = 'submit_sessions_limit_update', SessionDelete = 'submit_session_delete', diff --git a/src/routes/console/project-[project]/auth/security/updatePasswordHistory.svelte b/src/routes/console/project-[project]/auth/security/updatePasswordHistory.svelte index 27a28b5d14..e370787975 100644 --- a/src/routes/console/project-[project]/auth/security/updatePasswordHistory.svelte +++ b/src/routes/console/project-[project]/auth/security/updatePasswordHistory.svelte @@ -44,7 +44,7 @@

diff --git a/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte b/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte index de1bfab900..0c6aab2e4a 100644 --- a/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte +++ b/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte @@ -1,4 +1,4 @@ - + From ab93a3fb355cfb8c02ce59d5895021988bc625fe Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 20 Jul 2023 16:55:00 +0400 Subject: [PATCH 3/7] chore: resovle review comments --- package-lock.json | 9 +++--- package.json | 2 +- src/lib/actions/analytics.ts | 2 +- .../auth/security/+page.svelte | 4 +-- ....svelte => updatePersonalDataCheck.svelte} | 32 ++++++++++++------- src/routes/console/project-[project]/store.ts | 2 +- 6 files changed, 29 insertions(+), 22 deletions(-) rename src/routes/console/project-[project]/auth/security/{updatePasswordPersonalData.svelte => updatePersonalDataCheck.svelte} (61%) diff --git a/package-lock.json b/package-lock.json index 2d242e6edb..46a8434389 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "@appwrite/console", "dependencies": { "@analytics/google-analytics": "^1.0.5", - "@appwrite.io/console": "npm:christy-appwrite-console@0.0.5", + "@appwrite.io/console": "0.1.0", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", @@ -147,10 +147,9 @@ "integrity": "sha512-1Yw7u/COtxx06BfwlI+kVhsa/upKYzmCNrT4c8QDeCY2KMYlnijkUjtHiPU08HxyTIVB5j6d75O0YWVIHwQS8g==" }, "node_modules/@appwrite.io/console": { - "name": "christy-appwrite-console", - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/christy-appwrite-console/-/christy-appwrite-console-0.0.5.tgz", - "integrity": "sha512-9OHfJW1Tys4xeJh/p3kzNb92oqDT3zrz6Iu8ob6maKupyhb5ghWIa1ev0bowiYvJTDGkNVfDVXXHoXYbBbrmmQ==", + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.1.0.tgz", + "integrity": "sha512-GzCRUmaXAVgpGwxBNI3PrtCLHz7CM+epBHDDTHw8B2u61KbijGBO3GrwreXy91fy00RJiEzGlMSRzDgwsF3Tsg==", "dependencies": { "cross-fetch": "3.1.5", "isomorphic-form-data": "2.0.0" diff --git a/package.json b/package.json index f25008dc86..0e7ec8d6e1 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@analytics/google-analytics": "^1.0.5", - "@appwrite.io/console": "npm:christy-appwrite-console@0.0.5", + "@appwrite.io/console": "0.1.0", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", diff --git a/src/lib/actions/analytics.ts b/src/lib/actions/analytics.ts index 066eb70090..5de44f5719 100644 --- a/src/lib/actions/analytics.ts +++ b/src/lib/actions/analytics.ts @@ -143,7 +143,7 @@ export enum Submit { AuthStatusUpdate = 'submit_auth_status_update', AuthPasswordHistoryUpdate = 'submit_auth_password_history_limit_update', AuthPasswordDictionaryUpdate = 'submit_auth_password_dictionary_update', - AuthDisallowPersonalDataUpdate = 'submit_auth_disallow_personal_data_update', + AuthPersonalDataCheckUpdate = 'submit_auth_personal_data_check_update', SessionsLengthUpdate = 'submit_sessions_length_update', SessionsLimitUpdate = 'submit_sessions_limit_update', SessionDelete = 'submit_session_delete', diff --git a/src/routes/console/project-[project]/auth/security/+page.svelte b/src/routes/console/project-[project]/auth/security/+page.svelte index 477deb0f13..f69b913952 100644 --- a/src/routes/console/project-[project]/auth/security/+page.svelte +++ b/src/routes/console/project-[project]/auth/security/+page.svelte @@ -2,7 +2,7 @@ import { Container } from '$lib/layout'; import UpdatePasswordDictionary from './updatePasswordDictionary.svelte'; import UpdatePasswordHistory from './updatePasswordHistory.svelte'; - import UpdatePasswordPersonalData from './updatePasswordPersonalData.svelte'; + import UpdatePersonalDataCheck from './updatePersonalDataCheck.svelte'; import UpdateSessionLength from './updateSessionLength.svelte'; import UpdateSessionsLimit from './updateSessionsLimit.svelte'; import UpdateUsersLimit from './updateUsersLimit.svelte'; @@ -14,5 +14,5 @@ - + diff --git a/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte similarity index 61% rename from src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte rename to src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte index 0c6aab2e4a..0a12fdb506 100644 --- a/src/routes/console/project-[project]/auth/security/updatePasswordPersonalData.svelte +++ b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte @@ -10,38 +10,46 @@ import { project } from '../../store'; const projectId = $project.$id; - let disallowPersonalData = $project.authDisallowPersonalData ?? false; + let authPersonalDataCheck = $project.authPersonalDataCheck ?? false; - async function updateDisallowPersonalData() { + async function updatePersonalDataCheck() { try { - await sdk.forConsole.projects.updateDisallowPersonalData( - projectId, - disallowPersonalData + const path = '/projects/' + $project.$id + '/auth/personal-data'; + await sdk.forConsole.client.call( + 'PATCH', + new URL(sdk.forConsole.client.config.endpoint + path), + { + 'content-type': 'application/json' + }, + { + projectId, + enabled: authPersonalDataCheck + } ); await invalidate(Dependencies.PROJECT); addNotification({ type: 'success', - message: 'Updated disallow personal data.' + message: 'Toggled personal data checks for passwords' }); - trackEvent(Submit.AuthDisallowPersonalDataUpdate); + trackEvent(Submit.AuthPersonalDataCheckUpdate); } catch (error) { addNotification({ type: 'error', message: error.message }); - trackError(error, Submit.AuthDisallowPersonalDataUpdate); + trackError(error, Submit.AuthPersonalDataCheckUpdate); } } -

+ Personal Data

@@ -51,7 +59,7 @@ - diff --git a/src/routes/console/project-[project]/store.ts b/src/routes/console/project-[project]/store.ts index 2c96c80704..27b9b59db9 100644 --- a/src/routes/console/project-[project]/store.ts +++ b/src/routes/console/project-[project]/store.ts @@ -3,7 +3,7 @@ import { page } from '$app/stores'; import type { Models } from '@appwrite.io/console'; import type { BarSeriesOption } from 'echarts/charts'; -export const project = derived(page, ($page) => $page.data.project as Models.Project); +export const project = derived(page, ($page) => $page.data.project as Models.Project | any); export const onboarding = derived( project, ($project) => $project.platforms.length === 0 && $project.keys.length === 0 From 5df09999cb2a2a750f8703203aab94a8ec11f0a6 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Thu, 20 Jul 2023 18:10:36 +0400 Subject: [PATCH 4/7] chore: review comments --- .../auth/security/updatePersonalDataCheck.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte index 0a12fdb506..a9bb5a6265 100644 --- a/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte +++ b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte @@ -4,7 +4,7 @@ import { CardGrid, Heading } from '$lib/components'; import { Dependencies } from '$lib/constants'; import { Button, Form, InputSwitch } from '$lib/elements/forms'; - import FormList from '$lib/elements/forms/formList.svelte'; + import { FormList } from '$lib/elements/forms'; import { addNotification } from '$lib/stores/notifications'; import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; From 78f50f8831e90a769b808b45cee0bcbb6175391e Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 8 Aug 2023 17:03:42 +0000 Subject: [PATCH 5/7] feart: review comments --- .../auth/security/updatePersonalDataCheck.svelte | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte index a9bb5a6265..a9f906e475 100644 --- a/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte +++ b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte @@ -9,7 +9,6 @@ import { sdk } from '$lib/stores/sdk'; import { project } from '../../store'; - const projectId = $project.$id; let authPersonalDataCheck = $project.authPersonalDataCheck ?? false; async function updatePersonalDataCheck() { @@ -22,7 +21,7 @@ 'content-type': 'application/json' }, { - projectId, + projectId: $project.$id, enabled: authPersonalDataCheck } ); From b71c32e420b63bb5794a834a506f04e54c946df1 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 8 Aug 2023 20:27:45 +0000 Subject: [PATCH 6/7] feat: update to use new sdk --- package-lock.json | 9 +++++---- package.json | 2 +- .../auth/security/updatePersonalDataCheck.svelte | 14 +++----------- src/routes/console/project-[project]/store.ts | 2 +- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/package-lock.json b/package-lock.json index 46a8434389..2e109139cf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,7 @@ "name": "@appwrite/console", "dependencies": { "@analytics/google-analytics": "^1.0.5", - "@appwrite.io/console": "0.1.0", + "@appwrite.io/console": "npm:christy-console@^0.3.0", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", @@ -147,9 +147,10 @@ "integrity": "sha512-1Yw7u/COtxx06BfwlI+kVhsa/upKYzmCNrT4c8QDeCY2KMYlnijkUjtHiPU08HxyTIVB5j6d75O0YWVIHwQS8g==" }, "node_modules/@appwrite.io/console": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.1.0.tgz", - "integrity": "sha512-GzCRUmaXAVgpGwxBNI3PrtCLHz7CM+epBHDDTHw8B2u61KbijGBO3GrwreXy91fy00RJiEzGlMSRzDgwsF3Tsg==", + "name": "christy-console", + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/christy-console/-/christy-console-0.3.0.tgz", + "integrity": "sha512-EE2HbMm6ITE23VXrwVQ5VEvke9tf5OmaiUBlhkC+iuL+CkBw+n9dRxpCQvZil6P9ZbFSoCbK+QHGzM3R72c2BQ==", "dependencies": { "cross-fetch": "3.1.5", "isomorphic-form-data": "2.0.0" diff --git a/package.json b/package.json index 0e7ec8d6e1..e9e9ba98a6 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ }, "dependencies": { "@analytics/google-analytics": "^1.0.5", - "@appwrite.io/console": "0.1.0", + "@appwrite.io/console": "npm:christy-console@^0.3.0", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6", "@sentry/svelte": "^7.44.2", diff --git a/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte index a9f906e475..140eebb707 100644 --- a/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte +++ b/src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte @@ -13,17 +13,9 @@ async function updatePersonalDataCheck() { try { - const path = '/projects/' + $project.$id + '/auth/personal-data'; - await sdk.forConsole.client.call( - 'PATCH', - new URL(sdk.forConsole.client.config.endpoint + path), - { - 'content-type': 'application/json' - }, - { - projectId: $project.$id, - enabled: authPersonalDataCheck - } + await sdk.forConsole.projects.updatePersonalDataCheck( + $project.$id, + authPersonalDataCheck ); await invalidate(Dependencies.PROJECT); addNotification({ diff --git a/src/routes/console/project-[project]/store.ts b/src/routes/console/project-[project]/store.ts index 27b9b59db9..2c96c80704 100644 --- a/src/routes/console/project-[project]/store.ts +++ b/src/routes/console/project-[project]/store.ts @@ -3,7 +3,7 @@ import { page } from '$app/stores'; import type { Models } from '@appwrite.io/console'; import type { BarSeriesOption } from 'echarts/charts'; -export const project = derived(page, ($page) => $page.data.project as Models.Project | any); +export const project = derived(page, ($page) => $page.data.project as Models.Project); export const onboarding = derived( project, ($project) => $project.platforms.length === 0 && $project.keys.length === 0 From 4902198413ec5c1259282f23cc4fa63281b03013 Mon Sep 17 00:00:00 2001 From: Christy Jacob Date: Tue, 8 Aug 2023 20:32:02 +0000 Subject: [PATCH 7/7] chore: update dependencies --- package-lock.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package-lock.json b/package-lock.json index 575616c504..e00b9dd221 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,6 +7,7 @@ "name": "@appwrite/console", "dependencies": { "@analytics/google-analytics": "^1.0.5", + "@analytics/google-tag-manager": "^0.5.3", "@appwrite.io/console": "npm:christy-console@^0.3.0", "@appwrite.io/pink": "^0.0.6-rc.10", "@popperjs/core": "^2.11.6",