2 lines
3.5 KiB
JavaScript
2 lines
3.5 KiB
JavaScript
import{_ as c,g as u,$ as _,n as f,r as p,o as a,c as n,a as h,b as e,q as d,v as m,w as v,F as P,e as k,h as y,p as b,j as E}from"./index-9a3ecfe5.js";import{t as T}from"./style-1561178c.js";import{N as C}from"./Navbar-fcee2b9c.js";import{_ as x,a as I}from"./315220_eye_icon-30328a0f.js";const B=u(),N={name:"LoginPage",data(){return{email:"",password:"",toastMessage:"",toastBackground:"",forgotPassword:!1,showPassword:!1,toast:()=>{T(this.toastMessage,{hideProgressBar:!0,timeout:4e3,toastBackgroundColor:this.toastBackground})}}},components:{Navbar:C},methods:{showToast(i,s){this.toastMessage=i,this.toastBackground=s,this.toast()},login(){const i=u(k);if(!this.email||!this.password){this.showToast("Missing credentials","red");return}_(i,this.email,this.password).then(()=>{this.showToast("Logged in successfully","green"),this.$router.push({path:"/"})}).catch(s=>{s.message.includes("email")?this.showToast("Invalid email","red"):s.message.includes("user")?this.showToast("Could not find this user","red"):this.showToast(s.message,"red")})},resetPasswordEmail(){if(!this.email){this.showToast("Missing credentials","red");return}f(B,this.email).then(()=>{this.showToast("Reset password email sent","green"),this.email=""}).catch(i=>{i.message.includes("email")?this.showToast("Invalid email","red"):i.message.includes("user")?this.showToast("Could not find this user","red"):this.showToast(i.message,"red")})}}},l=i=>(b("data-v-b3c98f88"),i=i(),E(),i),V={id:"background"},L={class:"loginbox"},M=l(()=>e("img",{src:"https://cdn.discordapp.com/attachments/1017419092447207436/1063092138029625394/pixil-frame-0.png",class:"avatar"},null,-1)),A={key:0},F=l(()=>e("h1",null,"Login",-1)),S=l(()=>e("p",null,"Email Address",-1)),U=l(()=>e("p",null,"Password",-1)),D={id:"imgDiv"},R={key:1},H=l(()=>e("h1",null,"Forgot Password",-1)),j=l(()=>e("p",null,"Email Address",-1));function q(i,s,G,W,o,r){const w=p("Navbar"),g=p("router-link");return a(),n(P,null,[h(w),e("div",V,[e("div",L,[M,o.forgotPassword?(a(),n("div",R,[H,j,d(e("input",{type:"email","onUpdate:modelValue":s[7]||(s[7]=t=>o.email=t),"aria-describedby":"emailHelp",placeholder:"Enter email"},null,512),[[m,o.email]]),e("input",{onClick:s[8]||(s[8]=(...t)=>r.resetPasswordEmail&&r.resetPasswordEmail(...t)),type:"submit",name:"",value:"Send Reset Email"}),e("a",{onClick:s[9]||(s[9]=t=>{o.forgotPassword=!o.forgotPassword,this.email=""})},"Go back")])):(a(),n("div",A,[F,S,d(e("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=t=>o.email=t),"aria-describedby":"emailHelp",placeholder:"Enter email"},null,512),[[m,o.email]]),U,e("div",D,[o.showPassword?(a(),n("img",{key:0,id:"eyeImg",src:x,onClick:s[1]||(s[1]=t=>this.showPassword=!this.showPassword),alt:"show"})):(a(),n("img",{key:1,id:"eyeImg",src:I,onClick:s[2]||(s[2]=t=>this.showPassword=!this.showPassword)}))]),o.showPassword?d((a(),n("input",{key:0,type:"text","onUpdate:modelValue":s[3]||(s[3]=t=>o.password=t),placeholder:"Enter password"},null,512)),[[m,o.password]]):d((a(),n("input",{key:1,type:"password","onUpdate:modelValue":s[4]||(s[4]=t=>o.password=t),placeholder:"Enter password"},null,512)),[[m,o.password]]),e("input",{onClick:s[5]||(s[5]=(...t)=>r.login&&r.login(...t)),type:"submit",name:"",value:"Login"}),e("a",{onClick:s[6]||(s[6]=t=>{o.forgotPassword=!o.forgotPassword,this.email=""})},"Forgot password?"),e("a",null,[h(g,{to:"/signup"},{default:v(()=>[y("Don't have an account?")]),_:1})])]))])])],64)}const Q=c(N,[["render",q],["__scopeId","data-v-b3c98f88"]]);export{Q as default};
|