-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(user): simplifying user management
- Loading branch information
Showing
14 changed files
with
257 additions
and
132 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Weird issue, probably because the theme is loaded after primevue | ||
// So the divider style did not apply | ||
// This shall be removed after further update of the prime module | ||
.p-divider-solid.p-divider-horizontal:before { | ||
border-top-style: solid; | ||
} | ||
.p-divider-dashed.p-divider-horizontal:before { | ||
border-top-style: dashed; | ||
} | ||
.p-divider-solid.p-divider-vertical:before { | ||
border-left-style: solid; | ||
} | ||
.p-divider-dashed.p-divider-vertical:before { | ||
border-left-style: dashed; | ||
} |
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,63 @@ | ||
<template> | ||
<span class="p-float-label"> | ||
<Password | ||
toggle-mask | ||
:input-id="inputId" | ||
medium-regex="^(?=(?:[^A-Z]*[A-Z]){2,})(?=(?:[^a-z]*[a-z]){2,})(?=(?:[^\d]*\d){2,})(?=(?:[^\W_]*[\W_]){1,}).{8,}$" | ||
strong-regex="^(?=(?:[^A-Z]*[A-Z]){2,})(?=(?:[^a-z]*[a-z]){2,})(?=(?:[^\d]*\d){2,})(?=(?:[^\W_]*[\W_]){2,}).{8,}$" | ||
v-bind="$attrs" | ||
> | ||
<template #header> | ||
<small> | ||
<p class="mt-2"> | ||
{{ $t("components.form.registerPasswordInput.suggestions") }} | ||
</p> | ||
<ul class="pl-2 ml-2 mt-0" style="line-height: 1.5"> | ||
<li> | ||
{{ | ||
$t("components.form.registerPasswordInput.suggestionsLowercase") | ||
}} | ||
</li> | ||
<li> | ||
{{ | ||
$t("components.form.registerPasswordInput.suggestionsUppercase") | ||
}} | ||
</li> | ||
<li> | ||
{{ | ||
$t("components.form.registerPasswordInput.suggestionsNumber") | ||
}} | ||
</li> | ||
<li> | ||
{{ | ||
$t("components.form.registerPasswordInput.suggestionsSymbol") | ||
}} | ||
</li> | ||
<li> | ||
{{ $t("components.form.registerPasswordInput.suggestionsSize") }} | ||
</li> | ||
<li> | ||
{{ | ||
$t("components.form.registerPasswordInput.suggestionsUnicity") | ||
}} | ||
</li> | ||
</ul> | ||
</small> | ||
<Divider /> | ||
</template> | ||
</Password> | ||
<label :for="inputId"> | ||
<slot> | ||
{{ $t("components.form.registerPasswordInput.password") }} | ||
</slot> | ||
</label> | ||
</span> | ||
</template> | ||
<script lang="ts" setup> | ||
defineOptions({ | ||
inheritAttrs: false, | ||
}); | ||
const props = defineProps<{ | ||
inputId: string; | ||
}>(); | ||
</script> |
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 |
---|---|---|
@@ -1,39 +1,33 @@ | ||
<template> | ||
<h1 v-t="{ path: 'components.user.createForm.title' }"></h1> | ||
<form @submit.prevent.stop="registerUser"> | ||
<UserForm | ||
v-model:email="email" | ||
v-model:password="password" | ||
v-model:password-confirm="passwordConfirm" | ||
:is-password-confirmed="isPasswordConfirmed" | ||
/> | ||
{{ errorMessage }} | ||
<button :disabled="!isPasswordConfirmed"> | ||
{{ $t("components.user.createForm.ok") }} | ||
</button> | ||
</form> | ||
<UserForm class="card" @submit="submit" @cancel="navigateToList"> | ||
<template #buttons="{ isValid, cancel }"> | ||
<Button type="button" severity="danger" class="mr-2 mb-2" @click="cancel"> | ||
{{ $t("components.user.createForm.buttonCancel") }} | ||
</Button> | ||
<Button type="submit" :disabled="!isValid" class="mr-2 mb-2"> | ||
{{ $t("components.user.createForm.ok") }} | ||
</Button> | ||
</template> | ||
</UserForm> | ||
{{ errorMessage }} | ||
</template> | ||
<script setup lang="ts"> | ||
import useCreateUser from "~/composables/api/user/useCreateUser"; | ||
import useUser from "~/composables/user/useUser"; | ||
import type { UserInput } from "~/types/UserInput"; | ||
const { createUser, errorMessage } = useCreateUser(); | ||
const { | ||
email, | ||
password, | ||
passwordConfirm, | ||
isPasswordConfirmed, | ||
securedPassword, | ||
} = useUser(); | ||
const registerUser = async () => { | ||
const submit = async (state: UserInput) => { | ||
try { | ||
await createUser(email.value, securedPassword.value); | ||
await createUser(state); | ||
await navigateTo("/users"); | ||
} catch (e) { | ||
logger.info(e); | ||
} | ||
}; | ||
const navigateToList = () => { | ||
return navigateTo("/users/"); | ||
}; | ||
</script> | ||
|
||
<style scoped lang="scss"></style> |
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
Oops, something went wrong.