Merge pull request #405 from appwrite/disallow-personal-data

feat: add password personal data check
This commit is contained in:
Christy Jacob
2023-08-09 00:38:46 +04:00
committed by GitHub
6 changed files with 67 additions and 6 deletions
+5 -4
View File
@@ -8,7 +8,7 @@
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@analytics/google-tag-manager": "^0.5.3",
"@appwrite.io/console": "0.2.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",
@@ -154,9 +154,10 @@
"integrity": "sha512-1Yw7u/COtxx06BfwlI+kVhsa/upKYzmCNrT4c8QDeCY2KMYlnijkUjtHiPU08HxyTIVB5j6d75O0YWVIHwQS8g=="
},
"node_modules/@appwrite.io/console": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/@appwrite.io/console/-/console-0.2.0.tgz",
"integrity": "sha512-jgFYoskSCWaesF8zfsgYoTEKfyn6Kq3R9c5sM4AH2H+B/hmT8jwu9c3UU+LHBZ3BLdB9Zm3xOMa4bPyiQwzSeQ==",
"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"
+1 -1
View File
@@ -19,7 +19,7 @@
},
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "0.2.0",
"@appwrite.io/console": "npm:christy-console@^0.3.0",
"@appwrite.io/pink": "^0.0.6-rc.10",
"@analytics/google-tag-manager": "^0.5.3",
"@popperjs/core": "^2.11.6",
+1
View File
@@ -153,6 +153,7 @@ export enum Submit {
AuthStatusUpdate = 'submit_auth_status_update',
AuthPasswordHistoryUpdate = 'submit_auth_password_history_limit_update',
AuthPasswordDictionaryUpdate = 'submit_auth_password_dictionary_update',
AuthPersonalDataCheckUpdate = 'submit_auth_personal_data_check_update',
SessionsLengthUpdate = 'submit_sessions_length_update',
SessionsLimitUpdate = 'submit_sessions_limit_update',
SessionDelete = 'submit_session_delete',
@@ -2,6 +2,7 @@
import { Container } from '$lib/layout';
import UpdatePasswordDictionary from './updatePasswordDictionary.svelte';
import UpdatePasswordHistory from './updatePasswordHistory.svelte';
import UpdatePersonalDataCheck from './updatePersonalDataCheck.svelte';
import UpdateSessionLength from './updateSessionLength.svelte';
import UpdateSessionsLimit from './updateSessionsLimit.svelte';
import UpdateUsersLimit from './updateUsersLimit.svelte';
@@ -13,4 +14,5 @@
<UpdateSessionsLimit />
<UpdatePasswordHistory />
<UpdatePasswordDictionary />
<UpdatePersonalDataCheck />
</Container>
@@ -44,7 +44,7 @@
<FormList>
<InputSwitch
bind:value={passwordHistoryEnabled}
id="passwordHisotryEnabled"
id="passwordHistoryEnabled"
label="Password History" />
</FormList>
<p class="text">
@@ -0,0 +1,57 @@
<script lang="ts">
import { invalidate } from '$app/navigation';
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
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';
import { addNotification } from '$lib/stores/notifications';
import { sdk } from '$lib/stores/sdk';
import { project } from '../../store';
let authPersonalDataCheck = $project.authPersonalDataCheck ?? false;
async function updatePersonalDataCheck() {
try {
await sdk.forConsole.projects.updatePersonalDataCheck(
$project.$id,
authPersonalDataCheck
);
await invalidate(Dependencies.PROJECT);
addNotification({
type: 'success',
message: 'Toggled personal data checks for passwords'
});
trackEvent(Submit.AuthPersonalDataCheckUpdate);
} catch (error) {
addNotification({
type: 'error',
message: error.message
});
trackError(error, Submit.AuthPersonalDataCheckUpdate);
}
}
</script>
<Form onSubmit={updatePersonalDataCheck}>
<CardGrid>
<Heading tag="h2" size="7">Personal Data</Heading>
<svelte:fragment slot="aside">
<FormList>
<InputSwitch
bind:value={authPersonalDataCheck}
id="personalDataCheck"
label="Disallow Personal Data" />
</FormList>
<p class="text">
Do now allow passwords that contain any part of the user's personal data. This
includes the user's <code>name</code>, <code>email</code>, or <code>phone</code>.
</p>
</svelte:fragment>
<svelte:fragment slot="actions">
<Button disabled={authPersonalDataCheck === $project.authPersonalDataCheck} submit
>Update</Button>
</svelte:fragment>
</CardGrid>
</Form>