(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-77f3ca2c"],{"039a":function(t,e,s){"use strict";s("7174")},"578a":function(t,e,s){"use strict";s.r(e);var a=function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"vue-template forbgl"},[s("div",{staticClass:"container "},[s("div",{staticClass:"row mt-5 mb-5"},[s("div",{staticClass:"col-md-4 offset-md-4 vertical-center mt-5 loginw"},[s("h3",{staticClass:"text-center"},[t._v("Log in")]),0==t.login_hide?s("form",{staticClass:"ml-0"},[s("div",{staticClass:"form-group"},[s("label",[t._v("Email")]),s("input",{directives:[{name:"model",rawName:"v-model",value:t.email,expression:"email"}],staticClass:"form-control",attrs:{type:"email"},domProps:{value:t.email},on:{input:function(e){e.target.composing||(t.email=e.target.value)}}})]),s("div",{staticClass:"form-group"},[s("label",[t._v("Password")]),s("input",{directives:[{name:"model",rawName:"v-model",value:t.password,expression:"password"}],staticClass:"form-control",attrs:{type:"password"},domProps:{value:t.password},on:{input:function(e){e.target.composing||(t.password=e.target.value)}}})]),s("div",{staticClass:"status",attrs:{id:"login-status"}}),s("div",{staticClass:"my-2"},[s("router-link",{attrs:{to:{name:"forgot_password"}}},[t._v("Forgot password?")])],1),s("button",{staticClass:"btn submit-btn login-btn",attrs:{type:"submit"},on:{click:t.submit}},[t._v(" "+t._s(t.processingForm?"Please Wait...":"Login Now")+" ")])]):t._e(),1==t.otp_show?s("form",{staticClass:"ml-0"},[s("div",{staticClass:"form-group"},[s("label",[t._v("Enter OTP")]),s("div",{staticClass:"mobile-text"},[t._v(" Enter the code we just send on your Email. ")]),s("input",{directives:[{name:"model",rawName:"v-model",value:t.otp,expression:"otp"}],staticClass:"form-control",attrs:{type:"text",name:"otp",maxlength:"4"},domProps:{value:t.otp},on:{input:function(e){e.target.composing||(t.otp=e.target.value)}}})]),t.ress&&t.ress.otp?s("div",{staticClass:"text-danger"},[t._v(t._s(t.ress.otp[0]))]):t._e(),s("div",{staticClass:"status",attrs:{id:"login-status"}}),s("input",{staticClass:"submit-btn login-btn registerbtn",attrs:{type:"submit",value:"Send"},on:{click:t.send_otp}})]):t._e()])])]),t.user?s("h1",[t._v(t._s(t.user.firstName))]):t._e(),t.err?s("p",{staticClass:"error"},[t._v(t._s(t.err))]):t._e()])},o=[],r=(s("96cf"),s("1da1")),i=s("5530"),n=(s("bc3a"),s("f9df"),s("4a4a")),c=s("525b"),l=s("2f62"),u={name:"login",data:function(){return{err:"",email:"",password:"",otp:"",login_hide:!1,otp_show:!1,ress:{},processingForm:!1,action:"/api/login"}},computed:Object(i["a"])({},Object(l["d"])("auth",{user:"user",isLogged:"authenticated"})),methods:Object(i["a"])(Object(i["a"])({},Object(l["b"])("auth",{login:"login"})),{},{submit:function(t){var e=this;return Object(r["a"])(regeneratorRuntime.mark((function s(){return regeneratorRuntime.wrap((function(s){while(1)switch(s.prev=s.next){case 0:if(t.preventDefault(),!e.processingForm){s.next=3;break}return s.abrupt("return");case 3:return e.processingForm=!0,new FormData,s.prev=5,s.next=8,e.login({email:e.email,password:e.password});case 8:e.$toasted.success("Signed in successfully",{keepOnHover:!0,iconPack:"fontawesome",icon:"check",theme:"toasted-primary",duration:3e3}),location.href="dashboard",s.next=15;break;case 12:s.prev=12,s.t0=s["catch"](5),console.log("Error in logging in ",s.t0);case 15:e.processingForm=!1;case 16:case"end":return s.stop()}}),s,null,[[5,12]])})))()},send_otp:function(t,e){var s=this;t.preventDefault();var a={otp:e||this.otp,email:this.email};console.log("otp for verification: ",a),n["a"].post("/verify",a).then((function(t){s.setupAuth(t)})).catch((function(t){return 401===t.response.status&&(s.ress=t.response.data.errors||{}),console.log(t,t.data),t}))},setupAuth:function(t){console.log("otp verify res",t.data),this.$root.$emit("login",!0),localStorage.setItem("auth","true"),localStorage.setItem("user",JSON.stringify(t.data)),this.$toasted.success("Signed in successfully",{keepOnHover:!0,iconPack:"fontawesome",icon:"check",theme:"toasted-primary",duration:3e3}),location.href="dashboard"}}),mounted:function(){Object(c["a"])(),this.isLogged?this.$router.push({name:"dashboard"}):this.$router.push({name:"login"})}},p=u,m=(s("039a"),s("2877")),d=Object(m["a"])(p,a,o,!1,null,null,null);e["default"]=d.exports},7174:function(t,e,s){}}]); //# sourceMappingURL=chunk-77f3ca2c.40eacd4f.js.map