{"version":3,"sources":["webpack:///./src/components/PasswordReset/Index.vue?09dd","webpack:///./src/components/PasswordReset/attrs/data.js","webpack:///./src/components/PasswordReset/attrs/methods.js","webpack:///./src/components/PasswordReset/attrs/mounted.js","webpack:///./src/components/PasswordReset/attrs/props.js","webpack:///./src/components/PasswordReset/index.js","webpack:///./src/components/PasswordReset","webpack:///./src/components/PasswordReset/Index.vue","webpack:///../../../src/components/VGrid/VSpacer.ts","webpack:///../../../src/components/VForm/VForm.ts"],"names":["render","_vm","this","_h","$createElement","_c","_self","staticClass","attrs","class","box__dark","$route","meta","type","box__light","_v","on","$event","preventDefault","updatePassword","showPassword","errors","password","scopedSlots","_u","key","fn","proxy","model","value","callback","$$v","expression","showPasswordConfirmation","passwordConfirmation","name","includes","$vuetify","breakpoint","showSuccessDialog","$router","push","staticRenderFns","recoveryInfo","loadRecoveryInfo","self","api","getApiClient","$store","token","params","get","then","result","data","catch","patch","user","id","passwordRecovery","headers","error","response","violations","forEach","violation","propertyPath","message","String","methods","mounted","props","component","VBtn","VCard","VCardActions","VCardText","VCardTitle","VCol","VDialog","VForm","VIcon","VRow","VSpacer","VTextField","provide","form","inheritAttrs","disabled","lazyValidation","readonly","Boolean","inputs","watchers","errorBag","watch","handler","Object","deep","immediate","watchInput","watcher","input","val","_uid","valid","shouldValidate","validate","filter","reset","resetErrorBag","setTimeout","resetValidation","register","unregister","found","find","i","unwatch","h","novalidate","attrs$","submit","e","$slots"],"mappings":"wHAAA,IAAIA,EAAS,WAAa,IAAIC,EAAIC,KAASC,EAAGF,EAAIG,eAAmBC,EAAGJ,EAAIK,MAAMD,IAAIF,EAAG,OAAOE,EAAG,MAAM,CAACE,YAAY,eAAe,CAACF,EAAG,MAAM,CAACE,YAAY,wBAAwB,CAACF,EAAG,MAAM,CAACA,EAAG,QAAQ,CAACA,EAAG,QAAQ,CAACE,YAAY,sBAAsBC,MAAM,CAAC,KAAO,OAAO,CAACH,EAAG,MAAM,CAACE,YAAY,+BAA+BE,MAAM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AO,gBACLgH,YADK,GAEFtH,KAAKuH,QAEVzG,GAAI,CACF0G,OAAS,SAAAC,GAAD,OAAc,uBAEvBzH,KAAK0H,OATR","file":"js/PasswordReset.67af3664.js","sourcesContent":["var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:\"page__login\"},[_c('div',{staticClass:\"page__login__content\"},[_c('div',[_c('v-row',[_c('v-col',{staticClass:\"no-vertical-padding\",attrs:{\"cols\":\"12\"}},[_c('div',{staticClass:\"box box__secondary box__slim\",class:{box__dark: _vm.$route.meta.type === 'contractor', box__light: _vm.$route.meta.type === 'professional'}},[_c('h1',{staticClass:\"text-center condensed paddedHeader\",class:{'lighterGray--text': _vm.$route.meta.type === 'contractor'}},[_vm._v(\"Recuperar senha\")]),_c('v-form',{on:{\"submit\":function($event){$event.preventDefault();return _vm.updatePassword($event)}}},[_c('v-row',{attrs:{\"no-gutters\":\"\"}},[_c('v-col',{attrs:{\"cols\":\"4\"}},[_c('label',{staticClass:\"round text-center\",class:{\n 'light-label': _vm.$route.meta.type === 'professional',\n 'light-gray-label': _vm.$route.meta.type === 'contractor'\n },attrs:{\"for\":\"password\"}},[_vm._v(\"SENHA\")])]),_c('v-col',{attrs:{\"cols\":\"8\"}},[_c('v-text-field',{attrs:{\"id\":\"password\",\"type\":_vm.showPassword ? 'text' : 'password',\"append-icon\":\"remove_red_eye\",\"required\":\"\",\"hide-details\":\"auto\",\"error-messages\":_vm.errors.password},scopedSlots:_vm._u([{key:\"append\",fn:function(){return [_c('v-icon',{attrs:{\"color\":_vm.showPassword ? 'blue' : 'gray'},on:{\"click\":function($event){_vm.showPassword = !_vm.showPassword}}},[_vm._v(\"remove_red_eye \")])]},proxy:true}]),model:{value:(_vm.password),callback:function ($$v) {_vm.password=$$v},expression:\"password\"}})],1)],1),_c('v-row',{attrs:{\"no-gutters\":\"\"}},[_c('v-col',{attrs:{\"cols\":\"4\"}},[_c('label',{staticClass:\"round text-center\",class:{\n 'light-label': _vm.$route.meta.type === 'professional',\n 'light-gray-label': _vm.$route.meta.type === 'contractor'\n },attrs:{\"for\":\"passwordConfirmation\"}},[_vm._v(\"REPETIR SENHA\")])]),_c('v-col',{attrs:{\"cols\":\"8\"}},[_c('v-text-field',{attrs:{\"type\":_vm.showPasswordConfirmation ? 'text' : 'password',\"id\":\"passwordConfirmation\",\"required\":\"\",\"hide-details\":\"auto\",\"error-messages\":_vm.errors.passwordConfirmation},scopedSlots:_vm._u([{key:\"append\",fn:function(){return [_c('v-icon',{attrs:{\"color\":_vm.showPasswordConfirmation ? 'blue' : 'gray'},on:{\"click\":function($event){_vm.showPasswordConfirmation = !_vm.showPasswordConfirmation}}},[_vm._v(\"remove_red_eye \")])]},proxy:true}]),model:{value:(_vm.passwordConfirmation),callback:function ($$v) {_vm.passwordConfirmation=$$v},expression:\"passwordConfirmation\"}})],1)],1),_c('v-row',{attrs:{\"justify\":\"center\"}},[_c('v-col',{staticClass:\"text-center\",attrs:{\"cols\":\"6\"}},[_c('v-btn',{attrs:{\"block\":\"\",\"type\":\"submit\"}},[_vm._v(\"Alterar senha\")])],1)],1),_c('v-row',{attrs:{\"no-gutters\":\"\"}},[_c('v-col',{staticClass:\"text-center\",attrs:{\"cols\":\"12\"}},[_c('router-link',{staticClass:\"password-recovery-link\",attrs:{\"to\":{name: _vm.$route.meta.type === 'contractor' ? 'ContractorLogin' : 'ProfessionalLogin'}}},[_vm._v(\"Voltar \")])],1)],1)],1)],1)])],1),_c('v-dialog',{attrs:{\"max-width\":['xs', 'sm'].includes(_vm.$vuetify.breakpoint.name) ? '100%' : '50%'},model:{value:(_vm.showSuccessDialog),callback:function ($$v) {_vm.showSuccessDialog=$$v},expression:\"showSuccessDialog\"}},[_c('v-card',[_c('v-card-title',{staticClass:\"headline\"},[_vm._v(\"Sucesso!\")]),_c('v-card-text',{attrs:{\"align\":\"center\"}},[_c('p',[_vm._v(\"Sua senha foi alterada com sucesso! Agora vocĂȘ pode fazer login com a sua senha nova\")])]),_c('v-card-actions',[_c('v-spacer'),_c('v-btn',{attrs:{\"color\":\"blue darken-1\",\"text\":\"\"},on:{\"click\":function($event){$event.preventDefault();return _vm.$router.push({\n name: _vm.type === 'contractor' ? 'ContractorLogin' : 'ProfessionalLogin'\n })}}},[_vm._v(\"OK \")])],1)],1)],1)],1)])])}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","export default function() {\n return {\n password: '',\n passwordConfirmation: '',\n recoveryInfo: {},\n showPassword: false,\n showPasswordConfirmation: false,\n errors: {\n password: null,\n passwordConfirmation: null\n },\n showSuccessDialog: false\n }\n}\n","import getApiClient from '@/plugins/api-client'\n\nexport default {\n loadRecoveryInfo() {\n const self = this,\n api = getApiClient(self.$store),\n token = self.$route.params.token\n\n self.errors = {\n password: null,\n passwordConfirmation: null\n }\n\n api.get(`password_recoveries/${token}`)\n .then(result => {\n self.recoveryInfo = result.data\n })\n .catch(() => {\n self.$router.push({\n name: 'Home'\n })\n })\n },\n updatePassword() {\n const self = this,\n api = getApiClient(self.$store)\n\n self.errors = {\n password: null,\n passwordConfirmation: null\n }\n\n api.patch(`password_reset/${self.recoveryInfo.user.id}`, {\n password: self.password,\n passwordConfirmation: self.passwordConfirmation,\n passwordRecovery: self.recoveryInfo['@id']\n }, {\n headers: {\n 'Content-Type': 'application/merge-patch+json'\n }\n })\n .then(() => {\n self.showSuccessDialog = true\n })\n .catch(error => {\n error.response?.data?.violations?.forEach(violation => {\n self.errors[violation.propertyPath] = violation.message\n })\n })\n }\n}\n","export default function() {\n this.loadRecoveryInfo()\n}","export default {\n type: String\n}\n","import data from './attrs/data'\nimport methods from './attrs/methods'\nimport mounted from './attrs/mounted'\nimport props from './attrs/props'\n\nexport default {\n name: 'PasswordReset',\n data,\n methods,\n mounted,\n props\n}\n","import mod from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/eslint-loader/index.js??ref--13-0!./index.js?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../../node_modules/thread-loader/dist/cjs.js!../../../node_modules/babel-loader/lib/index.js!../../../node_modules/eslint-loader/index.js??ref--13-0!./index.js?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./Index.vue?vue&type=template&id=5ab684b4&\"\nimport script from \"./index.js?vue&type=script&lang=js&\"\nexport * from \"./index.js?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports\n\n/* vuetify-loader */\nimport installComponents from \"!../../../node_modules/vuetify-loader/lib/runtime/installComponents.js\"\nimport { VBtn } from 'vuetify/lib/components/VBtn';\nimport { VCard } from 'vuetify/lib/components/VCard';\nimport { VCardActions } from 'vuetify/lib/components/VCard';\nimport { VCardText } from 'vuetify/lib/components/VCard';\nimport { VCardTitle } from 'vuetify/lib/components/VCard';\nimport { VCol } from 'vuetify/lib/components/VGrid';\nimport { VDialog } from 'vuetify/lib/components/VDialog';\nimport { VForm } from 'vuetify/lib/components/VForm';\nimport { VIcon } from 'vuetify/lib/components/VIcon';\nimport { VRow } from 'vuetify/lib/components/VGrid';\nimport { VSpacer } from 'vuetify/lib/components/VGrid';\nimport { VTextField } from 'vuetify/lib/components/VTextField';\ninstallComponents(component, {VBtn,VCard,VCardActions,VCardText,VCardTitle,VCol,VDialog,VForm,VIcon,VRow,VSpacer,VTextField})\n","import './_grid.sass'\nimport { createSimpleFunctional } from '../../util/helpers'\n\nexport default createSimpleFunctional('spacer', 'div', 'v-spacer')\n","// Components\nimport VInput from '../VInput/VInput'\n\n// Mixins\nimport mixins from '../../util/mixins'\nimport BindsAttrs from '../../mixins/binds-attrs'\nimport { provide as RegistrableProvide } from '../../mixins/registrable'\n\n// Helpers\nimport { VNode } from 'vue'\n\ntype ErrorBag = Record\ntype VInputInstance = InstanceType\ntype Watchers = {\n _uid: number\n valid: () => void\n shouldValidate: () => void\n}\n\n/* @vue/component */\nexport default mixins(\n BindsAttrs,\n RegistrableProvide('form')\n /* @vue/component */\n).extend({\n name: 'v-form',\n\n provide (): object {\n return { form: this }\n },\n\n inheritAttrs: false,\n\n props: {\n disabled: Boolean,\n lazyValidation: Boolean,\n readonly: Boolean,\n value: Boolean,\n },\n\n data: () => ({\n inputs: [] as VInputInstance[],\n watchers: [] as Watchers[],\n errorBag: {} as ErrorBag,\n }),\n\n watch: {\n errorBag: {\n handler (val) {\n const errors = Object.values(val).includes(true)\n\n this.$emit('input', !errors)\n },\n deep: true,\n immediate: true,\n },\n },\n\n methods: {\n watchInput (input: any): Watchers {\n const watcher = (input: any): (() => void) => {\n return input.$watch('hasError', (val: boolean) => {\n this.$set(this.errorBag, input._uid, val)\n }, { immediate: true })\n }\n\n const watchers: Watchers = {\n _uid: input._uid,\n valid: () => {},\n shouldValidate: () => {},\n }\n\n if (this.lazyValidation) {\n // Only start watching inputs if we need to\n watchers.shouldValidate = input.$watch('shouldValidate', (val: boolean) => {\n if (!val) return\n\n // Only watch if we're not already doing it\n if (this.errorBag.hasOwnProperty(input._uid)) return\n\n watchers.valid = watcher(input)\n })\n } else {\n watchers.valid = watcher(input)\n }\n\n return watchers\n },\n /** @public */\n validate (): boolean {\n return this.inputs.filter(input => !input.validate(true)).length === 0\n },\n /** @public */\n reset (): void {\n this.inputs.forEach(input => input.reset())\n this.resetErrorBag()\n },\n resetErrorBag () {\n if (this.lazyValidation) {\n // Account for timeout in validatable\n setTimeout(() => {\n this.errorBag = {}\n }, 0)\n }\n },\n /** @public */\n resetValidation () {\n this.inputs.forEach(input => input.resetValidation())\n this.resetErrorBag()\n },\n register (input: VInputInstance) {\n this.inputs.push(input)\n this.watchers.push(this.watchInput(input))\n },\n unregister (input: VInputInstance) {\n const found = this.inputs.find(i => i._uid === input._uid)\n\n if (!found) return\n\n const unwatch = this.watchers.find(i => i._uid === found._uid)\n if (unwatch) {\n unwatch.valid()\n unwatch.shouldValidate()\n }\n\n this.watchers = this.watchers.filter(i => i._uid !== found._uid)\n this.inputs = this.inputs.filter(i => i._uid !== found._uid)\n this.$delete(this.errorBag, found._uid)\n },\n },\n\n render (h): VNode {\n return h('form', {\n staticClass: 'v-form',\n attrs: {\n novalidate: true,\n ...this.attrs$,\n },\n on: {\n submit: (e: Event) => this.$emit('submit', e),\n },\n }, this.$slots.default)\n },\n})\n"],"sourceRoot":""}