-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #405 from appwrite/disallow-personal-data
feat: add password personal data check
- Loading branch information
Showing
6 changed files
with
67 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/routes/console/project-[project]/auth/security/updatePersonalDataCheck.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |