import{n as i,i as n}from"./index.13f93d3a.js";import{H as l}from"./header.e25d2c3b.js";import{S as d,_ as f}from"./logo-gray.fc7f8dfb.js";const m={name:"find-pwd",components:{Header:l,SuccessDialog:d},mounted(){this.getCaptcha()},data(){return{showSuccess:!1,captcha:"",captcha_key:"",form:{data:{account:"",captcha:""},rules:{account:[{required:!0,trigger:"blur"},{pattern:n.email,trigger:"blur"}],captcha:[{required:!0,trigger:"blur"}]}}}},methods:{rebuildAccount(s){const t="@huabook.net";s&&s.indexOf("@")===-1&&s.indexOf(t)===-1&&(this.form.data.account=s+t)},doSubmit(){const{account:s,captcha:t}=this.form.data;this.$refs.form.validate(a=>{if(a){const e=this.$t("common.failure");this.$axios.post("/api/reset_password",{account:s,captcha:t,captcha_key:this.captcha_key}).then(c=>{const{code:r,msg:o=e,data:_}=c.data;r==0?this.showSuccess=!0:this.$message.error(o)}).catch(()=>{this.$message.error(e)})}})},getCaptcha(){const s=this.$t("common.failure");this.$axios.get("/api/captcha").then(t=>{const{code:a,msg:e=s,data:c}=t.data;if(a==0){const{key:r,img:o}=c;this.captcha_key=r,this.captcha=o}else this.$message.error(e)}).catch(()=>{this.$message.error(s)})},hideSuccess(s){this.showSuccess=s}},computed:{disabled(){const{account:s,captcha:t}=this.form.data;return!(s&&t)}}};var u=function(){var t=this,a=t._self._c;return a("div",{staticClass:"find-pwd"},[a("div",{staticClass:"find-pwd-content"},[t.showSuccess?a("SuccessDialog",{attrs:{title:t.$t("login.findPwd.success")},on:{onClose:t.hideSuccess}}):t._e(),a("Header"),a("div",{staticClass:"top"},[a("b",[t._v(t._s(t.$t("login.findPwd.leftTip")))])]),a("div",{staticClass:"bottom"},[a("div",{staticClass:"left"},[a("div",{staticClass:"form"},[a("el-form",{ref:"form",attrs:{model:t.form.data,rules:t.form.rules}},[a("div",{staticClass:"form-tip"},[t._v(" "+t._s(t.$t("login.findPwd.form.idTip"))+" ")]),a("el-form-item",{staticClass:"account",attrs:{prop:"account"}},[a("el-input",{attrs:{placeholder:"Huabook ID",clearable:""},on:{blur:e=>t.rebuildAccount(e.target.value)},model:{value:t.form.data.account,callback:function(e){t.$set(t.form.data,"account",e)},expression:"form.data.account"}})],1),a("el-form-item",{staticClass:"refresh"},[a("div",{staticClass:"container"},[a("div",{staticClass:"refresh-img"},[a("img",{staticClass:"refresh-img",attrs:{src:t.captcha,alt:"refresh"}})]),a("div",{staticClass:"refresh-button"},[a("a",{attrs:{href:"javascript:;"},on:{click:t.getCaptcha}},[a("i",{staticClass:"el-icon-refresh-right"}),t._v(" "+t._s(t.$t("login.common.form.refresh"))+" ")])]),a("div",{staticClass:"refresh-code"},[a("el-input",{attrs:{placeholder:t.$t("login.common.form.code"),clearable:""},model:{value:t.form.data.captcha,callback:function(e){t.$set(t.form.data,"captcha",e)},expression:"form.data.captcha"}})],1)])])],1)],1),a("div",{staticClass:"tip"},[t._v(" "+t._s(t.$t("login.findPwd.forget.text1"))+" "),a("router-link",{attrs:{to:"/findID"}},[t._v(t._s(t.$t("login.findPwd.forget.text2")))])],1),a("el-button",{attrs:{type:"primary",disabled:t.disabled,round:""},on:{click:t.doSubmit}},[t._v(t._s(t.$t("common.resume")))])],1),a("div",{staticClass:"spliter"}),a("div",{staticClass:"right"},[a("img",{attrs:{src:f,alt:"logo"}}),a("p",[t._v(t._s(t.$t("login.common.tip.forget")))])])])],1)])},h=[],p=i(m,u,h,!1,null,"7c86285a",null,null);const C=p.exports;export{C as default};
