diff --git a/src/components/FormLogin.vue b/src/components/FormLogin.vue index bf6e1efa1290826bd17194a4a0dfea02b0f2bb04..8d22292fcbce4efd3d79887b6c73745578f31324 100644 --- a/src/components/FormLogin.vue +++ b/src/components/FormLogin.vue @@ -33,7 +33,9 @@ const openForgotPasswordModal = (event: MouseEvent) => { } const submitReset = async () => { - await axios.post('http://localhost:8080/forgotPassword/changePasswordRequest', { email: resetEmail.value }) + await axios.post('http://localhost:8080/forgotPassword/changePasswordRequest', { + email: resetEmail.value + }) resetEmail.value = '' isModalOpen.value = false @@ -125,4 +127,4 @@ watch( </button> </template> </modal-component> -</template> \ No newline at end of file +</template> diff --git a/src/components/FormRegister.vue b/src/components/FormRegister.vue index d73170c4430b94a7b1bbb20566a1db47bcac6382..d32c4d0d3682864b2fd8298b62858b7d13f5ddf3 100644 --- a/src/components/FormRegister.vue +++ b/src/components/FormRegister.vue @@ -150,4 +150,4 @@ watch( <p>{{ errorMessage }}</p> </div> </div> -</template> \ No newline at end of file +</template> diff --git a/src/components/ModalComponent.vue b/src/components/ModalComponent.vue index fa640bb07926f32c90d50d1d3e8eef3116a8e5a9..43a34f224eaa25cae666068b36aaa7f21024f8f8 100644 --- a/src/components/ModalComponent.vue +++ b/src/components/ModalComponent.vue @@ -16,13 +16,10 @@ </div> </template> - <script setup lang="ts"> - defineProps({ title: String, message: String, - isModalOpen: Boolean, + isModalOpen: Boolean }) - </script> diff --git a/src/views/ResetPasswordView.vue b/src/views/ResetPasswordView.vue index 0b21888ad701f0784cdb595b4e89dce9cc0cfd90..d2816f564c9b2ec96a6657ae7f3f6e085a7638d4 100644 --- a/src/views/ResetPasswordView.vue +++ b/src/views/ResetPasswordView.vue @@ -19,7 +19,10 @@ class="w-full" :class="{ 'bg-green-200': isPasswordValid }" /> - <button class="absolute right-0 top-1 bg-transparent" @click="toggleShowPassword"> + <button + class="absolute right-0 top-1 bg-transparent" + @click="toggleShowPassword" + > {{ showPassword ? '🔓' : '🔒' }} </button> </div> @@ -27,9 +30,9 @@ v-model="confirm" :class="{ 'bg-green-200': newPassword == confirm && '' !== confirm.valueOf() }" class="mt-2 w-full" - name="confirm" - placeholder="Bekreft passord" - type="password" + name="confirm" + placeholder="Bekreft passord" + type="password" /> <div class="flex justify-center mt-10"> <button @@ -47,7 +50,7 @@ :message="'Passordet ditt er nå oppdatert. Du kan nå logge inn med ditt nye passord.'" :is-modal-open="isModalOpen" @close="isModalOpen = false" - > + > <template v-slot:buttons> <button @click="goToLogin" @@ -60,19 +63,18 @@ </div> </template> - <script setup lang="ts"> -import { computed, ref } from 'vue'; -import { useRoute, useRouter } from 'vue-router'; -import axios from 'axios'; -import ToolTip from '@/components/ToolTip.vue'; -import ModalComponent from '@/components/ModalComponent.vue'; +import { computed, ref } from 'vue' +import { useRoute, useRouter } from 'vue-router' +import axios from 'axios' +import ToolTip from '@/components/ToolTip.vue' +import ModalComponent from '@/components/ModalComponent.vue' -const route = useRoute(); +const route = useRoute() const router = useRouter() -const resetID = ref(route.query.resetID); -const userID = ref(route.query.userID); +const resetID = ref(route.query.resetID) +const userID = ref(route.query.userID) const newPassword = ref<string>('') const confirm = ref<string>('') const showPassword = ref<boolean>(false) @@ -83,8 +85,8 @@ const passwordRegex = /^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%^&+=!])(?=\S+ const isPasswordValid = computed(() => passwordRegex.test(newPassword.value)) const canResetPassword = computed(() => { - return isPasswordValid.value && newPassword.value === confirm.value && confirm.value !== ''; -}); + return isPasswordValid.value && newPassword.value === confirm.value && confirm.value !== '' +}) const resetPassword = async () => { isModalOpen.value = true @@ -95,17 +97,16 @@ const resetPassword = async () => { newPassword: newPassword.value } try { - await axios.post("http://localhost:8080/forgotPassword/resetPassword", { + await axios.post('http://localhost:8080/forgotPassword/resetPassword', { method: 'POST', headers: { 'Content-Type': 'application/json' }, - body: JSON.stringify(resetPasswordDTO), - }); - + body: JSON.stringify(resetPasswordDTO) + }) } catch (error) { - const err = error as Error; - console.error(err.message); + const err = error as Error + console.error(err.message) } -}; +} const toggleShowPassword = () => { showPassword.value = !showPassword.value @@ -115,4 +116,4 @@ const goToLogin = () => { isModalOpen.value = false router.push('/logginn') } -</script> \ No newline at end of file +</script>