芝麻web文件管理V1.00
编辑当前文件:/home/paymbalq/study.tamela.org/js/about.6ed45f02.js
"use strict";(self["webpackChunktamila"]=self["webpackChunktamila"]||[]).push([[594],{2549:function(e,s,o){o.r(s),o.d(s,{default:function(){return U}});var t=o(6768),r=o(4232),a=o(5130);const i=e=>((0,t.Qi)("data-v-86f2ecdc"),e=e(),(0,t.jt)(),e),n={style:{width:"100vw",height:"100vh",position:"fixed",top:"0",left:"0","z-index":"99"}},l={class:"login-logo"},c=["src"],u=["src"],d={class:"container"},p={class:"user signinBx"},h={class:"imgBx"},m=["src"],w={class:"formBx"},f={action:"",onsubmit:"return false;",autocomplete:"off"},g=i((()=>(0,t.Lk)("h2",null,"Sign In",-1))),k={key:0},L=i((()=>(0,t.Lk)("p",{class:"signup"},[(0,t.eW)(" Don't have an account ? "),(0,t.Lk)("a",{href:"mailto:officialtamela@gmail.com"},"Chat with us.")],-1))),_={class:"user signupBx"},y={class:"formBx"},$={action:"",onsubmit:"return false;",autocomplete:"off",ref:"signForm"},I=i((()=>(0,t.Lk)("h2",null,"Create an account",-1))),P={class:"signup"},R={class:"imgBx"},T=["src"];function C(e,s,i,C,O,v){return(0,t.uX)(),(0,t.CE)("main",null,[(0,t.Lk)("section",n,[(0,t.Lk)("div",l,[e.$store.state.isDark?((0,t.uX)(),(0,t.CE)("img",{key:0,src:o(844),alt:""},null,8,c)):((0,t.uX)(),(0,t.CE)("img",{key:1,src:o(5843),alt:""},null,8,u))]),(0,t.Lk)("div",d,[(0,t.Lk)("div",p,[(0,t.Lk)("div",h,[(0,t.Lk)("img",{src:o(296),alt:"",style:{}},null,8,m)]),(0,t.Lk)("div",w,[(0,t.Lk)("form",f,[g,O.login_error?((0,t.uX)(),(0,t.CE)("h3",k,(0,r.v_)(O.login_error),1)):(0,t.Q3)("",!0),(0,t.bo)((0,t.Lk)("input",{type:"text",autocomplete:"off",placeholder:"Username","onUpdate:modelValue":s[0]||(s[0]=e=>O.username=e)},null,512),[[a.Jo,O.username]]),(0,t.bo)((0,t.Lk)("input",{type:"password",autocomplete:"off",placeholder:"Password","onUpdate:modelValue":s[1]||(s[1]=e=>O.password=e)},null,512),[[a.Jo,O.password]]),(0,t.Lk)("input",{type:"submit",value:"Login",onClick:s[2]||(s[2]=e=>{v.login()})}),L])])]),(0,t.Lk)("div",_,[(0,t.Lk)("div",y,[(0,t.Lk)("form",$,[I,(0,t.bo)((0,t.Lk)("input",{type:"text",autocomplete:"off",placeholder:"Username",min:"8",required:"","onUpdate:modelValue":s[3]||(s[3]=e=>O.username=e)},null,512),[[a.Jo,O.username]]),(0,t.bo)((0,t.Lk)("input",{type:"email",autocomplete:"off",placeholder:"Email Address",required:"","onUpdate:modelValue":s[4]||(s[4]=e=>O.email=e)},null,512),[[a.Jo,O.email]]),(0,t.bo)((0,t.Lk)("input",{type:"password",autocomplete:"off",placeholder:"Create Password",required:"",style:{border:"2px solid transparent"},class:(0,r.C4)({error:O.create_password&&!v.checkPasswordValid(O.create_password)}),"onUpdate:modelValue":s[5]||(s[5]=e=>O.create_password=e)},null,2),[[a.Jo,O.create_password]]),(0,t.bo)((0,t.Lk)("input",{type:"password",autocomplete:"off",placeholder:"Confirm Password",required:"",style:{border:"2px solid transparent"},class:(0,r.C4)({error:O.password2&&(!(O.create_password===O.password2)||!v.checkPasswordValid(O.create_password))}),"onUpdate:modelValue":s[6]||(s[6]=e=>O.password2=e)},null,2),[[a.Jo,O.password2]]),(0,t.Lk)("input",{type:"submit",autocomplete:"off",onClick:s[7]||(s[7]=e=>{v.signup()}),value:"Sign Up"}),(0,t.Lk)("p",P,[(0,t.eW)(" Already have an account ? "),(0,t.Lk)("a",{href:"#",onClick:s[8]||(s[8]=e=>{v.toggleForm()})},"Sign in.")])],512)]),(0,t.Lk)("div",R,[(0,t.Lk)("img",{src:o(296),alt:"",style:{"object-position":"12%"}},null,8,T)])])])])])}o(4114);var O=o(8355),v=o(4084),b={name:"LoginView",components:{},data(){return{login_error:"",username:"",email:"",password:"",create_password:"",password2:""}},mounted(){document.title="Tamela Dashboard | Login",this.$root.showLoader=!0,this.$root.is_thinking=!1,this.$root.ai_toggle=!1,this.$store.commit("resetStore"),document.querySelector(".page-wrapper").style.padding="0",this.$store.commit("setRefresh",null),this.$root.chatMessages=[{user:"model",message:"Hello, How can i be of assistance?"}],this.$root.isAuthenticated=!1,O.A.defaults.headers.common["Authorization"]="",this.$root.showLoader=!1},methods:{toggleForm(){this.username="",this.password,document.querySelector(".container").classList.toggle("active")},async login(){const e={username:this.username,password:this.password};this.username&&this.password?(this.$root.showLoader=!0,await O.A.post("api/token",e).then((e=>{const s=e.data.access,o=e.data.refresh;this.$store.commit("resetStore"),this.$store.commit("setRefresh",o),O.A.defaults.headers.common["Authorization"]="Bearer "+s,v.oR.success("Logged in Successfully",{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT}),this.$root.isAuthenticated=!0,O.A.get("accounts/userdata?user="+this.username).then((e=>{const s=e.data;if(s.status&&s.data){const e=s.data.usercat;console.log(e),this.$store.commit("setUsercat",e),"tamelaDoctor"===e?(this.$store.commit("setDoctorUid",this.username),this.$router.push(this.$route.query.to||"/doctor")):"admin"===e||"hospitaladmin"===e?this.$router.push(this.$route.query.to||"/"):"doctor"===e?this.$router.push(this.$route.query.to||"/models"):(v.oR.error("Unauthorized user",{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT}),O.A.defaults.headers.common["Authorization"]="",this.$store.commit("resetStore"))}})).catch((e=>{console.error(e)}))})).catch((e=>{if(e.response){this.$root.showLoader=!1;for(const s in e.response.data){let o=[];o.push(`${e.response.data[s]}`),this.login_error=o[0]}v.oR.error(this.login_error,{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT})}}))):(this.login_error="Invalid username or password",v.oR.error("Username or Password cannot be left blank.",{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT}))},checkPasswordValid(e){return e.length>=8},async signup(){if(this.$refs.signForm.checkValidity())if(this.create_password===this.password2&&this.checkPasswordValid(this.create_password)){const e={username:this.username,email:this.email,password:this.create_password};this.$root.showLoader=!0,await O.A.post("accounts/user/create",e).then((e=>{const s=e.data;this.username="",this.password="",this.create_password="",this.password2="",this.$root.showLoader=!1,s.status?(v.oR.success("User Created Successfully",{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT}),this.toggleForm()):v.oR.error(s.message,{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT})})).catch((e=>{}))}else this.create_password!==this.password2?v.oR.error("Passwords must match!!",{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT}):v.oR.error("Password must be at least 8 digits long.",{autoClose:3e3,position:v.oR.POSITION.TOP_RIGHT});else this.$refs.signForm.reportValidity()}}},S=o(1241);const A=(0,S.A)(b,[["render",C],["__scopeId","data-v-86f2ecdc"]]);var U=A},296:function(e,s,o){e.exports=o.p+"img/10100802_4365975.8e4117bb.svg"}}]); //# sourceMappingURL=about.6ed45f02.js.map