Skip to content

Commit

Permalink
Merge pull request #405 from appwrite/disallow-personal-data
Browse files Browse the repository at this point in the history
feat: add password personal data check
  • Loading branch information
christyjacob4 authored Aug 8, 2023
2 parents 93fa7d3 + 4902198 commit 2a074e4
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 6 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions src/lib/actions/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -13,4 +14,5 @@
<UpdateSessionsLimit />
<UpdatePasswordHistory />
<UpdatePasswordDictionary />
<UpdatePersonalDataCheck />
</Container>
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
<FormList>
<InputSwitch
bind:value={passwordHistoryEnabled}
id="passwordHisotryEnabled"
id="passwordHistoryEnabled"
label="Password History" />
</FormList>
<p class="text">
Expand Down
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 2a074e4

Please sign in to comment.