(self["webpackChunkvue_antd_pro"]=self["webpackChunkvue_antd_pro"]||[]).push([[806],{3939:function(t){(function(){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n={rotl:function(t,e){return t<>>32-e},rotr:function(t,e){return t<<32-e|t>>>e},endian:function(t){if(t.constructor==Number)return 16711935&n.rotl(t,8)|4278255360&n.rotl(t,24);for(var e=0;e0;t--)e.push(Math.floor(256*Math.random()));return e},bytesToWords:function(t){for(var e=[],n=0,r=0;n>>5]|=t[n]<<24-r%32;return e},wordsToBytes:function(t){for(var e=[],n=0;n<32*t.length;n+=8)e.push(t[n>>>5]>>>24-n%32&255);return e},bytesToHex:function(t){for(var e=[],n=0;n>>4).toString(16)),e.push((15&t[n]).toString(16));return e.join("")},hexToBytes:function(t){for(var e=[],n=0;n>>6*(3-o)&63)):n.push("=");return n.join("")},base64ToBytes:function(t){t=t.replace(/[^A-Z0-9+\/]/gi,"");for(var n=[],r=0,i=0;r>>6-2*i);return n}};t.exports=n})()},51126:function(t,e,n){"use strict";n.r(e),n.d(e,{default:function(){return C}});var r=function(){var t=this,e=t._self._c;return e("div",{staticClass:"main"},[e("a-form",{ref:"formLogin",staticClass:"user-layout-login",attrs:{id:"formLogin",form:t.form},on:{submit:t.handleSubmit}},[t.isLoginError?e("a-alert",{staticStyle:{"margin-bottom":"24px"},attrs:{type:"error",showIcon:"",message:t.$t("user.login.message-invalid-credentials")}}):t._e(),e("a-form-item",[e("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["username",{rules:[{required:!0,message:t.$t("user.userName.required")},{validator:t.handleUsernameOrEmail}],validateTrigger:"change"}],expression:"[\n 'username',\n {rules: [{ required: true, message: $t('user.userName.required') }, { validator: handleUsernameOrEmail }], validateTrigger: 'change'}\n ]"}],attrs:{size:"large",type:"text",placeholder:"请输入用户名"}},[e("a-icon",{style:{color:"rgba(0,0,0,.25)"},attrs:{slot:"prefix",type:"user"},slot:"prefix"})],1)],1),e("a-form-item",[e("a-input-password",{directives:[{name:"decorator",rawName:"v-decorator",value:["password",{rules:[{required:!0,message:t.$t("user.password.required")}],validateTrigger:"blur"}],expression:"[\n 'password',\n {rules: [{ required: true, message: $t('user.password.required') }], validateTrigger: 'blur'}\n ]"}],attrs:{size:"large",placeholder:"请输入密码"}},[e("a-icon",{style:{color:"rgba(0,0,0,.25)"},attrs:{slot:"prefix",type:"lock"},slot:"prefix"})],1)],1),e("a-form-item",{staticStyle:{"margin-top":"24px"}},[e("a-button",{staticClass:"login-button",attrs:{size:"large",type:"primary",htmlType:"submit",loading:t.state.loginBtn,disabled:t.state.loginBtn}},[t._v(t._s(t.$t("user.login.login")))])],1)],1),t.requiredTwoStepCaptcha?e("two-step-captcha",{attrs:{visible:t.stepCaptchaVisible},on:{success:t.stepCaptchaSuccess,cancel:t.stepCaptchaCancel}}):t._e()],1)},i=[],o=n(76338),s=(n(26099),n(27495),n(83503)),a=n.n(s),u=function(){var t=this,e=this,n=e._self._c;return n("a-modal",{attrs:{centered:"",maskClosable:!1},on:{cancel:e.handleCancel},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[n("div",{style:{textAlign:"center"},attrs:{slot:"title"},slot:"title"},[e._v("两步验证")]),n("template",{slot:"footer"},[n("div",{style:{textAlign:"center"}},[n("a-button",{key:"back",on:{click:e.handleCancel}},[e._v("返回")]),n("a-button",{key:"submit",attrs:{type:"primary",loading:e.stepLoading},on:{click:e.handleStepOk}},[e._v(" 继续 ")])],1)]),n("a-spin",{attrs:{spinning:e.stepLoading}},[n("a-form",{attrs:{layout:"vertical","auto-form-create":function(e){t.form=e}}},[n("div",{staticClass:"step-form-wrapper"},[e.stepLoading?n("p",{staticStyle:{"text-align":"center"}},[e._v("正在验证.."),n("br"),e._v("请稍后")]):n("p",{staticStyle:{"text-align":"center"}},[e._v("请在手机中打开 Google Authenticator 或两步验证 APP"),n("br"),e._v("输入 6 位动态码")]),n("a-form-item",{style:{textAlign:"center"},attrs:{hasFeedback:"",fieldDecoratorId:"stepCode",fieldDecoratorOptions:{rules:[{required:!0,message:"请输入 6 位动态码!",pattern:/^\d{6}$/,len:6}]}}},[n("a-input",{style:{textAlign:"center"},attrs:{placeholder:"000000"},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.handleStepOk.apply(null,arguments)}}})],1),n("p",{staticStyle:{"text-align":"center"}},[n("a",{on:{click:e.onForgeStepCode}},[e._v("遗失手机?")])])],1)])],1)],2)},c=[],l={props:{visible:{type:Boolean,default:!1}},data:function(){return{stepLoading:!1,form:null}},methods:{handleStepOk:function(){var t=this,e=this;this.stepLoading=!0,this.form.validateFields((function(n,r){n?(t.stepLoading=!1,t.$emit("error",{err:n})):setTimeout((function(){e.stepLoading=!1,e.$emit("success",{values:r})}),2e3)}))},handleCancel:function(){this.visible=!1,this.$emit("cancel")},onForgeStepCode:function(){}}},f=l,p=n(81656),d=(0,p.A)(f,u,c,!1,null,"4a462ef6",null),g=d.exports,h=n(95353),m=n(67569),v=n(505),y={components:{TwoStepCaptcha:g},data:function(){return{customActiveKey:"tab1",loginBtn:!1,loginType:0,isLoginError:!1,requiredTwoStepCaptcha:!1,stepCaptchaVisible:!1,form:this.$form.createForm(this),state:{time:60,loginBtn:!1,loginType:0,smsSendBtn:!1}}},created:function(){var t=this;(0,v.N)({}).then((function(e){t.requiredTwoStepCaptcha=e.result.stepCode})).catch((function(){t.requiredTwoStepCaptcha=!1}))},methods:(0,o.A)((0,o.A)({},(0,h.i0)(["Login","Logout"])),{},{handleUsernameOrEmail:function(t,e,n){var r=this.state,i=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+((\.[a-zA-Z0-9_-]{2,3}){1,2})$/;i.test(e)?r.loginType=0:r.loginType=1,n()},handleTabClick:function(t){this.customActiveKey=t},handleSubmit:function(t){var e=this;t.preventDefault();var n=this.form.validateFields,r=this.state,i=this.customActiveKey,s=this.Login;r.loginBtn=!0;var u="tab1"===i?["username","password"]:["mobile","captcha"];n(u,{force:!0},(function(t,n){if(t)setTimeout((function(){r.loginBtn=!1}),600);else{var i=(0,o.A)({},n);delete i.username,i[r.loginType?"user_name":"email"]=n.username,i.password=a()(n.password),i.password=n.password,s(i).then((function(t){return e.loginSuccess(t)})).catch((function(t){return e.requestFailed(t)})).finally((function(){r.loginBtn=!1}))}}))},getCaptcha:function(t){var e=this;t.preventDefault();var n=this.form.validateFields,r=this.state;n(["mobile"],{force:!0},(function(t,n){if(!t){r.smsSendBtn=!0;var i=window.setInterval((function(){r.time--<=0&&(r.time=60,r.smsSendBtn=!1,window.clearInterval(i))}),1e3),o=e.$message.loading("验证码发送中..",0);(0,v.mN)({mobile:n.mobile}).then((function(t){setTimeout(o,2500),e.$notification["success"]({message:"提示",description:"验证码获取成功,您的验证码为:"+t.result.captcha,duration:8})})).catch((function(t){setTimeout(o,1),clearInterval(i),r.time=60,r.smsSendBtn=!1,e.requestFailed(t)}))}}))},stepCaptchaSuccess:function(){this.loginSuccess()},stepCaptchaCancel:function(){var t=this;this.Logout().then((function(){t.loginBtn=!1,t.stepCaptchaVisible=!1}))},loginSuccess:function(t){var e=this;this.$router.push({path:"/"}),setTimeout((function(){e.$notification.success({message:"欢迎",description:"".concat((0,m.Z$)(),",欢迎回来")})}),1e3),this.isLoginError=!1},requestFailed:function(t){this.isLoginError=!0,this.$notification["error"]({message:"错误",description:((t.response||{}).data||{}).message||"请求出现错误,请稍后再试",duration:4})}})},b=y,T=(0,p.A)(b,r,i,!1,null,"5fd7d6ec",null),C=T.exports},83503:function(t,e,n){(function(){var e=n(3939),r=n(92151).utf8,i=n(87206),o=n(92151).bin,s=function(t,n){t.constructor==String?t=n&&"binary"===n.encoding?o.stringToBytes(t):r.stringToBytes(t):i(t)?t=Array.prototype.slice.call(t,0):Array.isArray(t)||t.constructor===Uint8Array||(t=t.toString());for(var a=e.bytesToWords(t),u=8*t.length,c=1732584193,l=-271733879,f=-1732584194,p=271733878,d=0;d>>24)|4278255360&(a[d]<<24|a[d]>>>8);a[u>>>5]|=128<>>9<<4)]=u;var g=s._ff,h=s._gg,m=s._hh,v=s._ii;for(d=0;d>>0,l=l+b>>>0,f=f+T>>>0,p=p+C>>>0}return e.endian([c,l,f,p])};s._ff=function(t,e,n,r,i,o,s){var a=t+(e&n|~e&r)+(i>>>0)+s;return(a<>>32-o)+e},s._gg=function(t,e,n,r,i,o,s){var a=t+(e&r|n&~r)+(i>>>0)+s;return(a<>>32-o)+e},s._hh=function(t,e,n,r,i,o,s){var a=t+(e^n^r)+(i>>>0)+s;return(a<>>32-o)+e},s._ii=function(t,e,n,r,i,o,s){var a=t+(n^(e|~r))+(i>>>0)+s;return(a<>>32-o)+e},s._blocksize=16,s._digestsize=16,t.exports=function(t,n){if(void 0===t||null===t)throw new Error("Illegal argument "+t);var r=e.wordsToBytes(s(t,n));return n&&n.asBytes?r:n&&n.asString?o.bytesToString(r):e.bytesToHex(r)}})()},87206:function(t){function e(t){return!!t.constructor&&"function"===typeof t.constructor.isBuffer&&t.constructor.isBuffer(t)}function n(t){return"function"===typeof t.readFloatLE&&"function"===typeof t.slice&&e(t.slice(0,0))} /*! * Determine if an object is a Buffer * * @author Feross Aboukhadijeh * @license MIT */ t.exports=function(t){return null!=t&&(e(t)||n(t)||!!t._isBuffer)}},92151:function(t){var e={utf8:{stringToBytes:function(t){return e.bin.stringToBytes(unescape(encodeURIComponent(t)))},bytesToString:function(t){return decodeURIComponent(escape(e.bin.bytesToString(t)))}},bin:{stringToBytes:function(t){for(var e=[],n=0;n