feat: add password personal data check

This commit is contained in:
Christy Jacob
2023-04-15 14:18:02 +04:00
parent 5f188c13c6
commit d77cc751fe
5 changed files with 21 additions and 23 deletions
+5 -4
View File
@@ -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"
+1 -1
View File
@@ -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",
+1
View File
@@ -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',
@@ -44,7 +44,7 @@
<FormList>
<InputSwitch
bind:value={passwordHistoryEnabled}
id="passwordHisotryEnabled"
id="passwordHistoryEnabled"
label="Password History" />
</FormList>
<p class="text">
@@ -1,4 +1,4 @@
<!-- <script lang="ts">
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
import { CardGrid, Heading } from '$lib/components';
@@ -10,38 +10,37 @@
import { project } from '../../store';
const projectId = $project.$id;
let disallowPersonalData = $project.disallowPersonalData ?? false;
let disallowPersonalData = $project.authDisallowPersonalData ?? false;
async function updatePasswordPersonalData() {
async function updateDisallowPersonalData() {
try {
await sdk.forConsole.projects.updateAuthPasswordHistory(
await sdk.forConsole.projects.updateDisallowPersonalData(
projectId,
passwordHistoryEnabled ? passwordHistory : 0
disallowPersonalData
);
await invalidate(Dependencies.PROJECT);
initialPasswordHistoryEnabled = passwordHistoryEnabled;
addNotification({
type: 'success',
message: 'Updated password history limit.'
message: 'Updated disallow personal data.'
});
trackEvent(Submit.AuthPasswordHistoryUpdate);
trackEvent(Submit.AuthDisallowPersonalDataUpdate);
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.AuthPasswordHistoryUpdate);
trackError(error, Submit.AuthDisallowPersonalDataUpdate);
}
}
</script>
<Form onSubmit={updatePasswordPersonalData}>
<Form onSubmit={updateDisallowPersonalData}>
<CardGrid>
<Heading tag="h2" size="7">Personal Data</Heading>
<svelte:fragment slot="aside">
<FormList>
<InputSwitch
bind:value={passwordHistoryEnabled}
bind:value={disallowPersonalData}
id="passwordHisotryEnabled"
label="Disallow Personal Data" />
</FormList>
@@ -52,11 +51,8 @@
</svelte:fragment>
<svelte:fragment slot="actions">
<Button
disabled={(passwordHistory === $project.authPasswordHistory ||
$project.authPasswordHistory === 0) &&
initialPasswordHistoryEnabled === passwordHistoryEnabled}
submit>Update</Button>
<Button disabled={disallowPersonalData === $project.authDisallowPersonalData} submit
>Update</Button>
</svelte:fragment>
</CardGrid>
</Form> -->
</Form>