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AC7B,CACG","names":["authStore","useAuthStore","forgotPassword","forgotPasswordSubmit","actionerror","actionerrordetails","storeToRefs","modalAuthForgetPasswordStore","useModalAuthForgetPasswordStore","closeModal","isOpened","t","useI18n","loading","ref","loadinginmodal","process","alreadySent","email","form02Values","password","passwordconfirm","errorSummary","fieldChangeForgotFormProcess2","name","value","watch","newVal","oldVal","formSchema02","yup.string","formSchema01","closeAndResetThisModal","requestPasswordForgotEmail","username","forgotpass","error","requestforgotPasswordSubmit","code","newPassword"],"ignoreList":[],"sources":["../../../../../components/AuthForgetPasswordModal.vue"],"sourcesContent":["<script setup>\n\n  /**\n   * \n   * Komponens: modal + elfelejtett jelszó form\n   * \n  */\n\n  // Form and validation\n  import * as yup from 'yup';\n\n  // pinia stores\n  import { storeToRefs } from 'pinia';\n  import { useModalAuthForgetPasswordStore } from \"~/store/modalauthforgetpassword\";\n  import { useAuthStore } from \"~/store/auth\";\n\n  // auth\n  const authStore = useAuthStore();\n  const { forgotPassword, forgotPasswordSubmit } = authStore;\n  const { actionerror, actionerrordetails } = storeToRefs(authStore);\n  // forgotted passwd\n  const modalAuthForgetPasswordStore = useModalAuthForgetPasswordStore();\n  const { closeModal } = modalAuthForgetPasswordStore; // all non-reactive stuff\n  const { isOpened } = storeToRefs(modalAuthForgetPasswordStore) // have all reactive states\n\n  // nyelvi es routing beallitasok\n  // const localePath = useLocalePath();\n  // const { t, locale } = useI18n();\n  const { t } = useI18n();\n  // const route = useRoute();\n  // const router = useRouter();\n\n  const loading = ref(false);\n  const loadinginmodal = ref(false);\n  let process = ref(1);\n  let alreadySent = ref(false);\n  let email = ref('');\n  let form02Values = ref({});\n  let password = ref('');\n  let passwordconfirm = ref('');\n  let errorSummary = ref('');\n\n  // Ezt a DynamicForm komponens kapja meg mint prop,\n  //  és akkor hívja meg, ha egy input mező értéke változik\n  const fieldChangeForgotFormProcess2 = (name, value) => {\n    if(name === 'passwordconfirm') {\n      passwordconfirm.value = value\n    }\n    if(name === 'password') {\n      password.value = value\n    }\n  };\n\n  watch(() => passwordconfirm.value, async (newVal, oldVal) => {\n    if(newVal !== oldVal) {\n      formSchema02.fields[3].rules = yup.string().required(t('yup.required')).test('passwords-are-same', 'Passwords does not match', () => {\n        return password.value === passwordconfirm.value;\n      }).label(t('New password again'))\n    }\n  });\n\n  watch(() => password.value, async (newVal, oldVal) => {\n    if(newVal !== oldVal) {\n      formSchema02.fields[3].rules = yup.string().required(t('yup.required')).test('passwords-are-same', 'Passwords does not match', () => {\n        return password.value === passwordconfirm.value;\n      }).label(t('New password again'))\n    }\n  });\n\n  // \n  const formSchema01 = {\n    fields: [\n    {\n        id: 'email',\n        label: t('E-mail address') + ' *',\n        hint: '',\n        placeholder: t('E-mail address'),\n        name: 'email',\n        as: 'input',\n        type: 'email',\n        value: email.value || '',\n        validateOnInput: true,\n        validateOnMount: true,\n        validateOnChange: true,\n        // initialValue: authenticated.value ? '' : '',\n        rules: yup.string().required(t('yup.required')).email(t('yup.email')).min(8, t('yup.min')).max(100).label(t('E-mail address')),\n      },\n    ],\n  };\n\n  const formSchema02 = {\n    fields: [\n      {\n        id: 'email2',\n        label: t('E-mail address') + ' *',\n        hint: '',\n        placeholder: t('E-mail address'),\n        name: 'email2',\n        as: 'input',\n        type: 'email',\n        value: email.value || '',\n        validateOnInput: true,\n        validateOnMount: true,\n        validateOnChange: true,\n        disabled: true,\n        // initialValue: 'asdfsadf',\n        rules: yup.string().required(t('yup.required')).email(t('yup.email')).min(8, t('yup.min')).max(100).label(t('E-mail address')),\n      },\n      {\n        id: 'code',\n        label: t('forgotpassword.code') + ' *',\n        hint: '',\n        placeholder: t('forgotpassword.code'),\n        name: 'code',\n        as: 'input',\n        type: 'text',\n        validateOnInput: true,\n        validateOnMount: true,\n        validateOnChange: true,\n        // initialValue: '',\n        rules: yup.string().required(t('yup.required')).label(t('forgotpassword.code')),\n      },\n      {\n        id: 'password',\n        ref: 'password',\n        label: t('New password'),\n        hint: '',\n        name: 'password',\n        placeholder: 'password',\n        as: 'input',\n        type: 'password',\n        validateOnChange: true,\n        validateOnInput: true, \n        rules: yup.string().required(t('yup.required')).matches(/^(?!.* )(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d/\\W|_/g]{8,100}$/,{ message: () => t('passwordinput.error') }).label(t('New password')),\n      },\n      {\n        id: 'passwordconfirm',\n        label: t('New password again'),\n        hint: '',\n        name: 'passwordconfirm',\n        placeholder: 'passwordconfirm',\n        as: 'input',\n        type: 'password',\n        validateOnMount: true,\n        validateOnChange: true,\n        validateOnInput: true, \n        // rules: yup.string().required(t('yup.required')),\n        // rules: yup.string().required(t('yup.required')).oneOf([yup.ref('password'), null], 'Passwords must match')\n        // rules: yup.string().required(t('yup.required')).test('passwords-match', 'Passwords must match', function(value){ return yup.ref('password') === value }),\n//rules: yup.string().oneOf([yup.ref('password'), null], `Passwords does not match: ${yup.ref('password')}`),\n        // rules: yup.string().oneOf([passwordConfirm.value, null], `Passwords does not match: ${yup.ref('password')}`),\n        // rules: yup.string().oneOf([passwordConfirm.value, null], 'Passwords must match'),\n        // rules: yup.string().test('passwords-are-same', 'Passwords does not match', (value, context) => {\n        //   console.log(value + ' VS ' + passwordConfirm.value );\n        //   if(value === passwordConfirm.value) {\n        //     true;\n        //   }\n        // }),\n        rules: yup.string().required(t('yup.required')).matches(/^(?!.* )(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[a-zA-Z\\d/\\W|_/g]{8,100}$/,{ message: () => t('passwordinput.error') }).label(t('New password again')),\n      },\n    ],\n  };\n\n  const initialValuesForm = {};\n\n  // állapot nullázása és az ablak bezárása:\n  const closeAndResetThisModal = () => {\n    process.value = 1;\n    closeModal();\n  };\n\n  // \"email sent\" message and go to the third form page\n  const gotMail = () => {\n    process.value = 3;\n  };\n\n  // Ideiglenes megerősítő kódot küldünk a felhasználó e-mail címére és \n  //  átirányítjuk a következő form-hoz, ahol a kiküldött kóddal tud továbblépni.\n  const requestPasswordForgotEmail = async (value) => {\n    loadinginmodal.value = true;\n    console.log('requestPasswordForgotEmail:', value);\n    // a cognito beállítások alapján a user felhasználóneve az emailcíme:\n    const username = value.email;\n    // A második form email mező értékének előzetes beállítása:\n    formSchema02.fields[0].value = value.email;\n    try {\n      // e-mail kiküldése\n      const forgotpass = await forgotPassword(username);\n      // console.log('forgotpass: ', forgotpass);\n      alreadySent.value = true;\n      process.value = 3;\n      errorSummary.value = '';\n    } catch (error) {\n      // ha már létezik ez a user: a bejelentkezés ablakra van szükség\n      // ezt csak és kizárólag egy új regisztráció indításával tudom ellenőrizni:\n      if (error.code === 'LimitExceededException') {\n        // LimitExceededException: Attempt limit exceeded, please try after some time.\n        errorSummary.value = t('auth.forgetpassword.LimitExceededException');\n      } else {\n        alreadySent.value = false;\n      }\n    } finally {\n      loadinginmodal.value = false;\n    }\n  };\n\n  // Send confirmation code to user's email and go to the second form page\n  const requestforgotPasswordSubmit = async (value) => {\n    form02Values.value = value;\n    console.log('requestforgotPasswordSubmit:', value);\n    loadinginmodal.value = true;\n    const username = value.email2;\n    const code = value.code;\n    const newPassword = value.password;\n    try {\n      const forgotpass = await forgotPasswordSubmit(username, code, newPassword);\n      console.log(forgotpass);\n      process.value = 4;\n    } catch (error) {\n      errorSummary.value = error.message;\n    } finally {\n      loadinginmodal.value = false;\n    }\n  };\n\n</script>\n\n<template>\n  <Transition>\n    <div\n      v-show=\"isOpened === true\"\n      class=\"absolute top-0 left-0 w-screen h-full bg-opacity-50 z-50 xs:px-2 sm:px-1\"\n      style=\"background-color: rgba(0, 0, 0, 0.5)\"\n    >\n      <div\n        class=\"xs:max-w-sm sm:max-w-md md:max-w-lg lg:max-w-2xl xl:max-w-3xl mt-16 lg:mt-52 xl:mt-52 mx-auto bg-page-dark p-2 rounded-lg shadow-lg\"\n      >\n        <!-- loader icon -->\n        <div v-show=\"loading\" class=\"mx-auto text-center\">\n          <UiLoadSpinner v-show=\"loading\" />\n        </div>\n        <div v-if=\"!loading\" class=\"flex justify-between items-center\">\n          <!-- modal title -->\n          <h2 class=\"text-xl text-txt-light\">\n            <font-awesome-icon\n              :icon=\"['fas', 'key']\"\n              class=\"text-navtxtsecondary-dark\"\n            />\n            {{ $t('Forgot password') }}\n          </h2>\n          <div>\n            <!-- close modal -->\n            <button\n              type=\"button\"\n              class=\"w-8 h-8 p-2 bg-primary text-txt-light hover:shadow-sm items-center rounded-md font-sans font-light text-sm disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none\"\n              @click=\"closeAndResetThisModal()\"\n            >\n              <font-awesome-icon :icon=\"['fas', 'times']\" />\n            </button>\n          </div>\n        </div>\n        <div class=\"relative mt-5 flex justify-around\">\n          <div>\n            <div\n              class=\"w-8 h-8 mx-auto rounded-full flex items-center border border-primary\"\n              :class=\"process !== 1 ? 'text-gray-dark' : ''\"\n            >\n              <span v-if=\"process > 1\" class=\"text-center w-full\">\n                <font-awesome-icon :icon=\"['fas', 'check']\" class=\"text-3xl\" />\n              </span>\n              <span v-else class=\"text-center w-full font-sans text-sm\">1</span>\n            </div>\n            <div\n              class=\"text-center text-xs font-sans font-light mt-1\"\n              :class=\"process !== 1 ? 'text-gray-dark' : ''\"\n            >\n              {{ $t('Forgot password request') }}\n            </div>\n          </div>\n          <div>\n            <div\n              class=\"w-8 h-8 mx-auto rounded-full flex items-center border border-primary\"\n              :class=\"process !== 3 ? 'text-gray-dark' : ''\"\n            >\n              <span v-if=\"process > 3\" class=\"text-center w-full\">\n                <font-awesome-icon :icon=\"['fas', 'check']\" class=\"text-3xl\" />\n              </span>\n              <span v-else class=\"text-center w-full font-sans text-sm\">2</span>\n            </div>\n            <div\n              class=\"text-center text-xs font-sans font-light mt-1\"\n              :class=\"process !== 3 ? 'text-gray-dark' : ''\"\n            >\n              {{ $t('new password setup') }}\n            </div>\n          </div>\n        </div>\n        <div class=\"productdetails p-2 my-5\">\n          <div v-if=\"process === 1\">\n            <!-- Email kuldes az itt megadott email-re az ideiglenes koddal -->\n            <DynamicForm \n              :key=\"'forgotFormProcess1'\"\n              :schema=\"formSchema01\" \n              :submitForm=\"requestPasswordForgotEmail\" \n              :submitButtonPlaceOnThe=\"'center'\"\n              :initialValues=\"{}\"\n              :fieldPairs=\"{}\"\n              :validateOnMount=\"false\"\n              class=\"mx-auto bg-white shadow-md rounded-md px-8 pt-6 pb-8 m-4 flex flex-col bg-boxbg-dark\"\n            >\n              <template v-slot:infobarbetween>\n                <LazyUiInfoMessage v-if=\"errorSummary!==''\" class=\"flex items-center content-center justify-center\">\n                  <font-awesome-icon\n                    :icon=\"['fas', 'exclamation-circle']\"\n                    class=\"text-xl text-red-dark m-1\"\n                  />\n                  {{ errorSummary }}\n                </LazyUiInfoMessage>\n                <div v-show=\"errorSummary === ''\" class=\"my-5 text-txt-light text-sm font-sans font-light\">\n                  <p class=\"text-center\">\n                    {{ $t('forgotpassword.temporarycodeinfo') }}\n                  </p>\n                </div>\n              </template>\n              <template v-slot:submitbuttonlabel>\n                <span v-if=\"alreadySent\">\n                  {{ $t('forgotpassword.sendreminderemailalreadysent') }}..\n                </span>\n                <span v-else>\n                  {{ $t('forgotpassword.sendreminderemail') }}..\n                </span>\n              </template>\n            </DynamicForm>\n          </div>\n          <div v-if=\"process === 3\">\n            <!-- E-mailben érkezett kód megadása és ellenőrzése az új jelszó beállításához -->\n            <DynamicForm \n              :key=\"'forgotFormProcess2'\"\n              :schema=\"formSchema02\" \n              :fieldChange=\"fieldChangeForgotFormProcess2\"\n              :submitForm=\"requestforgotPasswordSubmit\" \n              :submitButtonPlaceOnThe=\"'center'\"\n              :initialValues=\"{}\"\n              :fieldPairs=\"{}\"\n              :validateOnMount=\"false\"\n              class=\"mx-auto bg-white shadow-md rounded-md px-8 pt-6 pb-8 m-4 flex flex-col bg-boxbg-dark\"\n            >\n              <template v-slot:infobarbetween v-if=\"errorSummary\">\n                <UiInfoMessage v-show=\"errorSummary !== ''\">\n                  <UiInputTextErrorMessage>\n                    {{ $t(errorSummary) }}\n                  </UiInputTextErrorMessage>\n                </UiInfoMessage>\n              </template>\n              <template v-slot:submitbuttonlabel>\n                {{ $t('Sign in') }}\n              </template>\n            </DynamicForm>\n          </div>\n          <div v-if=\"process === 4\">\n            <UiInfoMessage class=\"text-center\">\n              {{ $t('forgotpassword.changesuccessful') }}\n            </UiInfoMessage>\n            <div>\n              <!-- close modal -->\n              <div class=\"my-5 text-center\">\n                <button\n                  type=\"button\"\n                  class=\"mx-auto px-4 py-2 bg-primary text-txt-light hover:shadow-sm items-center rounded-md font-sans font-light text-sm disabled:opacity-50 disabled:cursor-not-allowed focus:outline-none\"\n                  :class=\"loadinginmodal ? 'disabled' : ''\"\n                  @click=\"closeAndResetThisModal()\"\n                >\n                  <font-awesome-icon :icon=\"['fas', 'times']\" />\n                  {{ $t('Close') }}..\n                </button>\n              </div>\n            </div>\n          </div>\n        </div>\n      </div>\n    </div>\n  </Transition>\n</template>\n\n<!-- \n  watch: {\n    cognitousername(newVal, oldVal) {\n      console.log('newVal', newVal)\n      this.authForgetPasswordForm.email = newVal\n    },\n  },\n\n  forgotPassword: 'auth/forgotPassword',\n  forgotPasswordSubmit: 'auth/forgotPasswordSubmit',\n\n  closeModal: 'authforgetpasswordmodal/closeModal',\n  setCognitoUsername: 'authforgetpasswordmodal/setCognitoUsername',\n\n-->\n"],"file":"_nuxt/chunks/AuthForgetPasswordModal--BhL56c2-.js"}