feat: review backend and frontend
- update to the latest version of Java/SpringBoot - update to the latest version NuxtJS - add account/password update - add account creation - add account password reset - add bundle to regroup questions and add default questions on user creation - add bundle creation
This commit is contained in:
		
							
								
								
									
										55
									
								
								frontend/pages/account/password/confirm-reset.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								frontend/pages/account/password/confirm-reset.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| <script lang="ts" setup> | ||||
| import {useAccountStore} from "~/store/account"; | ||||
| import type {ApiError} from "~/composables/fetch-api"; | ||||
| import {useNotificationStore} from "~/store/notification"; | ||||
|  | ||||
| definePageMeta({ | ||||
|   layout: 'main-header' | ||||
| }); | ||||
|  | ||||
| const email = ref(); | ||||
| const newPassword = ref(); | ||||
| const confirmationPassword = ref(); | ||||
|  | ||||
| onMounted(() => { | ||||
|   if (!useRoute().query.token) { | ||||
|     navigateTo("/"); | ||||
|   } | ||||
| }); | ||||
|  | ||||
| function resetPassword() { | ||||
|   const token = useRoute().query.token; | ||||
|   useAccountStore().resetPassword(token, email.value, newPassword.value, confirmationPassword.value) | ||||
|     .then(() => { | ||||
|       useNotificationStore().pushNotification("success", {message: "Votre mot de passe a bien été ré-initialisé."}); | ||||
|       navigateTo("/login"); | ||||
|     }) | ||||
|     .catch((apiError: ApiError) => { | ||||
|       let details; | ||||
|       if (apiError.fieldErrors) { | ||||
|         details = apiError.fieldErrors.map(error => `${error.fields!.join(", ")} ${error.detail}`); | ||||
|       } | ||||
|       useNotificationStore().pushNotification("warn", {message: apiError.message, details}); | ||||
|     }); | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <template> | ||||
|   <section> | ||||
|     <h1>Ré-initialisé mon mot de passe</h1> | ||||
|     <form class="form" @submit.prevent="resetPassword"> | ||||
|       <label for="email">Mon e-mail</label> | ||||
|       <input id="email" v-model="email" type="email" autocomplete="username" required> | ||||
|       <p class="form__help">Votre mot de passe doit fait au moins 8 caractères, et être composé d’au moins une | ||||
|         majuscule, une minuscule, un chiffre de 0 à 9, et un caractère spécial parmi @?!#$&;,:</p> | ||||
|       <label for="newPassword">Nouveau mot de passe</label> | ||||
|       <input id="newPassword" v-model="newPassword" type="password" required> | ||||
|       <label for="confirmationPassword">Confirmation du mot de passe</label> | ||||
|       <input id="confirmationPassword" v-model="confirmationPassword" type="password" required> | ||||
|       <div class="button-container"> | ||||
|         <button class="button orange" type="submit">Enregistrer</button> | ||||
|       </div> | ||||
|     </form> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
							
								
								
									
										46
									
								
								frontend/pages/account/password/index.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								frontend/pages/account/password/index.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,46 @@ | ||||
| <script lang="ts" setup> | ||||
| import {useAccountStore} from "~/store/account"; | ||||
| import type {ApiError} from "~/composables/fetch-api"; | ||||
| import {useNotificationStore} from "~/store/notification"; | ||||
|  | ||||
| const currentPassword = ref(); | ||||
| const newPassword = ref(); | ||||
| const confirmationPassword = ref(); | ||||
|  | ||||
| function updatePassword() { | ||||
|   useAccountStore().updatePassword(currentPassword.value, newPassword.value, confirmationPassword.value) | ||||
|     .then(() => { | ||||
|       useNotificationStore().pushNotification("success",{message: "Votre mot de passe a bien été modifié."}); | ||||
|       navigateTo("/account"); | ||||
|     }) | ||||
|     .catch((apiError: ApiError) => { | ||||
|       let details; | ||||
|       if (apiError.fieldErrors) { | ||||
|         details = apiError.fieldErrors.map(error => `${error.fields!.join(", ")} ${error.detail}`); | ||||
|       } | ||||
|       useNotificationStore().pushNotification("warn",{message: apiError.message, details}); | ||||
|     }); | ||||
| } | ||||
| </script> | ||||
|  | ||||
| <template> | ||||
|   <section> | ||||
|     <h1>Modifier mon mot de passe</h1> | ||||
|     <form class="form" @submit.prevent="updatePassword"> | ||||
|       <label for="currentPassword">Mot de passe actuel</label> | ||||
|       <input id="currentPassword" v-model="currentPassword" type="password" autocomplete="currentPassword" required> | ||||
|       <p class="form__help">Votre mot de passe doit fait au moins 8 caractères, et être composé d’au moins une | ||||
|         majuscule, une minuscule, | ||||
|         un chiffre de 0 à 9, et un caractère spécial parmi @?!#$&;,:</p> | ||||
|       <label for="newPassword">Nouveau mot de passe</label> | ||||
|       <input id="newPassword" v-model="newPassword" type="password" required> | ||||
|       <label for="confirmationPassword">Confirmation du mot de passe</label> | ||||
|       <input id="confirmationPassword" v-model="confirmationPassword" type="password" required> | ||||
|       <div class="button-container"> | ||||
|         <nuxt-link class="button gray button-back" to="/account" aria-label="Retour à la page précédente">❮</nuxt-link> | ||||
|         <button class="button orange" type="submit">Enregistrer</button> | ||||
|       </div> | ||||
|     </form> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
							
								
								
									
										61
									
								
								frontend/pages/account/password/reset.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								frontend/pages/account/password/reset.vue
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,61 @@ | ||||
| <script lang="ts" setup> | ||||
| import {useAccountStore} from "~/store/account"; | ||||
| import {useNotificationStore} from "~/store/notification"; | ||||
| import type {ApiError} from "~/composables/fetch-api"; | ||||
|  | ||||
| definePageMeta({ | ||||
|   layout: 'main-header' | ||||
| }); | ||||
|  | ||||
| const email = ref(); | ||||
| const loading = ref(false); | ||||
|  | ||||
| function sendEmail() { | ||||
|   loading.value = true; | ||||
|   useAccountStore() | ||||
|     .requestPasswordReset(email.value) | ||||
|     .then(() => { | ||||
|       useNotificationStore().pushNotification("success", {message: "Consultez vos emails pour réinitialiser votre mot de passe."}) | ||||
|       navigateTo("login"); | ||||
|     }) | ||||
|     .catch((apiError: ApiError) => { | ||||
|       let details; | ||||
|       if (apiError.fieldErrors) { | ||||
|         details = apiError.fieldErrors.map(error => `${error.fields!.join(", ")} ${error.detail}`); | ||||
|       } | ||||
|       useNotificationStore().pushNotification("warn", {message: apiError.message, details}); | ||||
|     }) | ||||
|     .finally(() => { | ||||
|       loading.value = false; | ||||
|     }); | ||||
| } | ||||
|  | ||||
| </script> | ||||
|  | ||||
| <template> | ||||
|   <section> | ||||
|     <h1>Mot de passe oublié</h1> | ||||
|     <form class="form" @submit.prevent="sendEmail"> | ||||
|       <p>Entrez votre email pour recevoir un lien permettant de réinitialiser le mot de passe associé à votre | ||||
|         compte.</p> | ||||
|       <input v-model="email" type="email" placeholder="E-mail" required/> | ||||
|       <div class="button-container"> | ||||
|         <nuxt-link class="button gray button-back" to="/login" aria-label="Retour à la page de login">❮</nuxt-link> | ||||
|         <button class="button orange" type="submit">Envoyer l'e-mail</button> | ||||
|       </div> | ||||
|       <loader class="loader" v-if="loading"/> | ||||
|     </form> | ||||
|   </section> | ||||
| </template> | ||||
|  | ||||
| <style lang="scss" scoped> | ||||
| .form { | ||||
|   display: flex; | ||||
|   flex-direction: column; | ||||
|   gap: $small; | ||||
| } | ||||
|  | ||||
| .loader { | ||||
|   align-self: center; | ||||
| } | ||||
| </style> | ||||
		Reference in New Issue
	
	Block a user