import{n as p,U as c}from"./index-DDNMzpZj.js";const d={head:{title:"Granblue.Party - Reset your password"},data(){return{email:"",token:"",captcha:!1,error_message:""}},methods:{resetPassword(){const o={email:this.email,token:this.token,password:this.$refs.password.value,captcha:this.captcha};if(this.error_message="",this.$refs.password.value!=this.$refs.password2.value){this.error_message="Passwords don't match",this.$refs.password.value="",this.$refs.password2.value="";return}this.axios.post("/user/reset",o).then(s=>{this.$router.push({name:"home"}).then(e=>this.$store.commit("show_modal_login",!0)).catch(e=>{})}).catch(s=>this.$store.dispatch("addAxiosErrorMessage",s))}},mounted(){c.isEmpty(this.$route.query.t)||c.isEmpty(this.$route.query.e)?this.$router.push({name:"home"}).catch(()=>{}):(this.email=this.$route.query.e,this.token=this.$route.query.t)}};var u=function(){var s=this,e=s._self._c;return e("div",{staticClass:"flex flex-col items-center gap-y-8"},[e("h1",[s._v("Set a new password")]),e("form",{staticClass:"m-1",on:{submit:function(t){return t.preventDefault(),s.resetPassword()}}},[e("div",{staticClass:"mt-4"},[e("label",{attrs:{for:"email"}},[s._v("Email address")]),e("input",{directives:[{name:"model",rawName:"v-model",value:s.email,expression:"email"}],staticClass:"input w-full",attrs:{id:"email",type:"email",placeholder:"Email address",disabled:""},domProps:{value:s.email},on:{input:function(t){t.target.composing||(s.email=t.target.value)}}})]),e("div",[e("label",{attrs:{for:"password"}},[s._v("Password")]),e("input",{ref:"password",staticClass:"input w-full",attrs:{id:"password",placeholder:"Password",type:"password",minlength:"1",required:"",autofocus:""}})]),e("div",{staticClass:"pb-2"},[e("label",{attrs:{for:"password2"}},[s._v("Confirm password")]),e("input",{ref:"password2",staticClass:"input w-full",attrs:{id:"password2",placeholder:"Password",type:"password",minlength:"1",required:""}})]),e("input",{directives:[{name:"model",rawName:"v-model",value:s.captcha,expression:"captcha"}],staticStyle:{display:"none !important"},attrs:{type:"checkbox",name:"captcha",tabindex:"-1",autocomplete:"off"},domProps:{checked:Array.isArray(s.captcha)?s._i(s.captcha,null)>-1:s.captcha},on:{change:function(t){var a=s.captcha,i=t.target,n=!!i.checked;if(Array.isArray(a)){var l=null,r=s._i(a,l);i.checked?r<0&&(s.captcha=a.concat([l])):r>-1&&(s.captcha=a.slice(0,r).concat(a.slice(r+1)))}else s.captcha=n}}}),s.error_message.length>0?e("p",[e("fa-icon",{staticClass:"text-red-400",attrs:{icon:["fas","exclamation-triangle"]}}),s._v(" "+s._s(s.error_message)+" ")],1):e("p",[s._v(" ")]),e("input",{staticClass:"btn btn-blue mt-6",attrs:{type:"submit",value:"Change password"}})])])},h=[],m=p(d,u,h,!1,null,null);const _=m.exports;export{_ as default};
