- 修复BCryptPasswordEncoder密码验证问题 - 实现密码设置提示弹窗功能(仅对无密码用户显示一次) - 优化修改密码逻辑和验证流程 - 更新Welcome页面背景样式 - 清理临时SQL文件和测试代码 - 移动数据库备份文件到database/backups目录 - 删除不必要的MD文档和临时文件
2 lines
12 KiB
JavaScript
2 lines
12 KiB
JavaScript
import{aA as U,aB as q,r as L,l as h,c as y,m as A,al as I,z as H,A as c,B as t,D as E,R as v,a5 as B,P as f,M as w,J as k,O as M,u as N}from"./vue-vendor-164775a6.js";import{_ as R,u as z,a as D,s as F,l as J,b as O}from"./index-467ea2ad.js";import{E as u}from"./element-plus-83a396df.js";import"./utils-edfcd65b.js";const W={class:"login-page"},j={class:"login-card"},G={class:"login-tabs"},Q={width:"248",height:"59",viewBox:"0 0 248 59",fill:"none",xmlns:"http://www.w3.org/2000/svg",class:"tabs-svg"},X={class:"login-form"},Y={class:"email-login"},e2={class:"email-input-group"},s2={key:0,class:"input-error"},o2={key:0,class:"code-input-wrapper"},a2={key:0,class:"input-error"},t2={key:1,class:"password-input-group"},l2={key:0,class:"input-error"},r2={class:"agreement-text"},n2={__name:"Login",setup(i2){const K=U(),b=q(),g=z(),p=L(0);let x=null;const r=L("email"),o=h({email:"",code:"",password:""}),a=h({email:"",code:"",password:"",server:""}),d=L(null),C=L(null),V=L(null),_=y(()=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email)),S=y(()=>/^\d{6}$/.test(o.code)),$=y(()=>o.password&&o.password.length>=6);y(()=>r.value==="email"?_.value&&S.value:_.value&&$.value),A(()=>{b.query.email&&(o.email=b.query.email)});const P=async()=>{var m,e,n;if(a.email="",a.code="",a.password="",a.server="",!o.email){a.email="请输入邮箱地址",d.value&&d.value.focus&&d.value.focus();return}if(!_.value){a.email="请输入正确的邮箱地址",d.value&&d.value.focus&&d.value.focus();return}try{const s=await F(o.email);s.data&&s.data.success?(u.success("验证码已发送到您的邮箱"),T()):u.error(((m=s.data)==null?void 0:m.message)||"发送失败")}catch(s){console.error("发送验证码失败:",s),u.error(((n=(e=s.response)==null?void 0:e.data)==null?void 0:n.message)||"网络错误,请稍后重试")}},T=()=>{p.value=60,x=setInterval(()=>{p.value--,p.value<=0&&(clearInterval(x),x=null)},1e3)},Z=async()=>{var m,e,n;if(!o.email){u.warning("请输入邮箱地址");return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email)){u.warning("请输入正确的邮箱地址");return}try{console.log("开始登录... 登录方式:",r);let s=null;if(r.value==="email"){if(!o.code){a.code="请输入验证码",C.value&&C.value.focus&&C.value.focus();return}if(!S.value){a.code="验证码格式不正确,请输入6位数字",C.value&&C.value.focus&&C.value.focus();return}s=await J({email:o.email,code:o.code})}else{if(!o.password){a.password="请输入密码",V.value&&V.value.focus&&V.value.focus();return}if(!$.value){a.password="密码至少 6 位",V.value&&V.value.focus&&V.value.focus();return}s=await O({email:o.email,password:o.password})}if(s&&s.data&&s.data.success){sessionStorage.setItem("token",s.data.data.token),sessionStorage.setItem("user",JSON.stringify(s.data.data.user)),g.user=s.data.data.user,g.token=s.data.data.token,console.log("登录成功,用户信息:",g.user),u.success("登录成功"),await new Promise(i=>setTimeout(i,200));const l=b.query.redirect||"/profile";console.log("准备跳转到:",l),await K.replace(l),console.log("路由跳转完成")}else{const l=((m=s==null?void 0:s.data)==null?void 0:m.message)||"登录失败";a.server=l,u.error(l)}}catch(s){console.error("Login error:",s);const l=((n=(e=s.response)==null?void 0:e.data)==null?void 0:n.message)||"登录失败,请重试";a.server=l,u.error(l)}};return(m,e)=>{const n=I("el-input"),s=I("el-button"),l=I("router-link");return H(),c("div",W,[e[13]||(e[13]=t("div",{class:"logo"},[t("img",{src:D,alt:"Logo"})],-1)),t("div",j,[e[12]||(e[12]=t("div",{class:"welcome-title"},[t("span",{class:"welcome-text"},"欢迎来到"),t("span",{class:"brand-name"},"VidFlow")],-1)),t("div",G,[(H(),c("svg",Q,[t("g",{class:E(["tab-email",{active:r.value==="email"}]),onClick:e[0]||(e[0]=i=>r.value="email"),style:{cursor:"pointer"}},[...e[5]||(e[5]=[t("path",{d:"M13.598 21.112V40.638H11.076V39.13H4.316V40.638H1.768V21.112H6.344V17.55H8.996V21.112H13.598ZM4.316 36.712H6.344V31.122H4.316V36.712ZM8.996 36.712H11.076V31.122H8.996V36.712ZM4.316 28.73H6.344V23.556H4.316V28.73ZM8.996 23.556V28.73H11.076V23.556H8.996ZM15.34 18.772H24.232V20.748C23.452 23.4 22.62 25.818 21.736 28.054C23.556 30.654 24.466 32.76 24.492 34.398C24.492 35.958 24.154 37.024 23.504 37.596C22.802 38.22 21.398 38.532 19.318 38.532L18.512 35.802C19.474 35.906 20.28 35.984 20.956 35.984C21.372 35.958 21.658 35.828 21.814 35.62C21.918 35.464 21.97 35.048 21.996 34.398C21.97 32.786 20.982 30.68 19.032 28.054C19.864 26.156 20.67 23.868 21.45 21.164H17.914V41.73H15.34V18.772ZM27.716 27.326H31.616V24.83H34.346V27.326H37.57V29.926H34.346V30.446C35.542 31.538 36.79 32.734 38.038 34.06L36.53 36.348C35.698 35.048 34.97 33.93 34.346 33.046V41.756H31.616V33.202C30.654 35.23 29.432 37.102 27.924 38.818L26.754 35.776C28.756 34.06 30.238 32.11 31.226 29.926H27.716V27.326ZM49.4 25.48V41.73H46.774V40.82H41.106V41.73H38.48V25.48H49.4ZM41.106 38.428H46.774V36.244H41.106V38.428ZM41.106 33.956H46.774V32.058H41.106V33.956ZM41.106 29.77H46.774V27.872H41.106V29.77ZM31.538 21.762C30.966 22.75 30.316 23.634 29.614 24.466L27.248 22.958C28.782 21.294 29.874 19.5 30.498 17.576L33.124 18.148C32.968 18.564 32.838 18.98 32.682 19.37H38.974V21.762H35.568C36.088 22.49 36.504 23.192 36.842 23.842L34.346 24.778C33.878 23.738 33.306 22.724 32.682 21.762H31.538ZM42.64 21.762C42.12 22.828 41.574 23.816 40.95 24.726L38.636 23.244C39.962 21.424 40.898 19.474 41.444 17.446L44.018 18.018C43.862 18.486 43.732 18.928 43.602 19.37H50.83V21.762H46.67C47.19 22.49 47.632 23.192 47.97 23.842L45.578 24.752C45.11 23.712 44.538 22.724 43.862 21.762H42.64ZM57.538 28.522H72.566V35.282H57.538V28.522ZM69.836 32.89V30.888H60.268V32.89H69.836ZM60.45 35.438C61.282 36.296 62.036 37.31 62.712 38.454H67.626C68.354 37.466 68.978 36.426 69.524 35.36L72.046 36.27C71.578 37.05 71.084 37.778 70.564 38.454H76.232V41.028H53.716V38.454H59.826C59.28 37.726 58.63 37.05 57.902 36.4L60.45 35.438ZM56.368 21.112C57.564 21.996 58.63 22.854 59.514 23.686C60.424 22.802 61.152 21.866 61.724 20.878H55.822V18.382H64.792V20.41C64.194 21.918 63.388 23.27 62.374 24.466H68.822C67.262 22.75 66.014 20.904 65.104 18.876L67.366 17.628C67.782 18.59 68.276 19.5 68.848 20.358C69.758 19.63 70.538 18.85 71.188 18.018L73.086 19.708C72.306 20.644 71.37 21.528 70.304 22.308C70.72 22.828 71.188 23.296 71.708 23.764C72.8 22.932 73.71 21.996 74.49 20.982L76.388 22.646C75.608 23.634 74.672 24.544 73.632 25.35C74.776 26.182 76.024 26.962 77.428 27.664L75.634 29.744C73.606 28.6 71.838 27.352 70.33 25.974V26.936H60.788V26.104C59.124 27.56 57.07 28.782 54.626 29.796L52.962 27.664C54.782 26.962 56.316 26.156 57.616 25.246C56.758 24.466 55.744 23.66 54.548 22.828L56.368 21.112ZM82.368 18.408H97.864V26.806H102.258V29.276H98.228L100.282 30.966C98.93 32.63 97.396 33.956 95.68 34.892C97.604 36.296 99.84 37.518 102.388 38.61L101.01 41.002C97.37 39.286 94.432 37.232 92.196 34.814V38.974C92.196 40.794 91.39 41.73 89.804 41.73H86.762L86.164 39.182C87.1 39.286 88.01 39.364 88.894 39.364C89.284 39.364 89.492 39 89.492 38.324V34.918C86.944 37.154 83.928 39.156 80.47 40.95L79.378 38.428C83.278 36.66 86.632 34.58 89.492 32.136V29.276H79.768V26.806H95.108V25.012H83.252V22.672H95.108V20.852H82.368V18.408ZM83.018 29.666C84.526 30.706 85.8 31.746 86.84 32.786L85.072 34.554C84.162 33.566 82.888 32.526 81.224 31.382L83.018 29.666ZM98.176 29.276H92.196V31.824C92.69 32.37 93.236 32.89 93.834 33.41C95.498 32.422 96.954 31.044 98.176 29.276Z"},null,-1)])],2),e[7]||(e[7]=t("path",{d:"M124 18.75V40.25",stroke:"#9EA9B6"},null,-1)),t("g",{class:E(["tab-password",{active:r.value==="password"}]),onClick:e[1]||(e[1]=i=>r.value="password"),style:{cursor:"pointer"}},[...e[6]||(e[6]=[t("path",{d:"M155.362 18.46V35.126H152.996V20.956H148.212V35.126H145.768V18.46H155.362ZM149.434 22.49H151.722V31.018C151.644 33.93 151.202 36.27 150.37 38.012C149.564 39.65 148.264 40.898 146.47 41.782L145.014 39.494C146.704 38.636 147.848 37.57 148.472 36.322C149.044 34.944 149.356 33.176 149.434 31.018V22.49ZM152.684 35.724C153.984 37.05 155.076 38.35 155.986 39.624L154.036 41.574C153.308 40.274 152.294 38.896 150.942 37.414L152.684 35.724ZM162.044 30.732H160.328V38.298C161.342 37.882 162.33 37.362 163.318 36.738L163.786 39.156C162.122 40.196 160.224 41.028 158.092 41.704L156.974 39.286C157.442 39.052 157.676 38.688 157.676 38.22V30.732H156.064V28.132H157.676V17.68H160.328V28.132H168.622V30.732H164.384C165.528 34.45 167.14 37.336 169.168 39.364L167.322 41.47C165.008 39.026 163.24 35.438 162.044 30.732ZM166.23 18.746L168.31 20.41C166.516 23.322 164.436 25.506 162.044 26.91L160.588 24.83C162.772 23.478 164.67 21.45 166.23 18.746ZM174.966 18.356H191.034V26.026H174.966V18.356ZM188.278 23.608V20.8H177.722V23.608H188.278ZM176.76 30.16H171.118V27.534H194.856V30.16H179.516L178.814 32.422H191.372C191.164 36.894 190.748 39.546 190.072 40.378C189.396 41.184 188.122 41.6 186.198 41.6C184.924 41.6 183.78 41.522 182.766 41.392L181.882 38.922C183.286 39.052 184.508 39.13 185.6 39.13C186.874 39.13 187.654 38.87 187.966 38.402C188.252 37.908 188.46 36.738 188.59 34.866H175.564L176.76 30.16ZM201.538 28.522H216.566V35.282H201.538V28.522ZM213.836 32.89V30.888H204.268V32.89H213.836ZM204.45 35.438C205.282 36.296 206.036 37.31 206.712 38.454H211.626C212.354 37.466 212.978 36.426 213.524 35.36L216.046 36.27C215.578 37.05 215.084 37.778 214.564 38.454H220.232V41.028H197.716V38.454H203.826C203.28 37.726 202.63 37.05 201.902 36.4L204.45 35.438ZM200.368 21.112C201.564 21.996 202.63 22.854 203.514 23.686C204.424 22.802 205.152 21.866 205.724 20.878H199.822V18.382H208.792V20.41C208.194 21.918 207.388 23.27 206.374 24.466H212.822C211.262 22.75 210.014 20.904 209.104 18.876L211.366 17.628C211.782 18.59 212.276 19.5 212.848 20.358C213.758 19.63 214.538 18.85 215.188 18.018L217.086 19.708C216.306 20.644 215.37 21.528 214.304 22.308C214.72 22.828 215.188 23.296 215.708 23.764C216.8 22.932 217.71 21.996 218.49 20.982L220.388 22.646C219.608 23.634 218.672 24.544 217.632 25.35C218.776 26.182 220.024 26.962 221.428 27.664L219.634 29.744C217.606 28.6 215.838 27.352 214.33 25.974V26.936H204.788V26.104C203.124 27.56 201.07 28.782 198.626 29.796L196.962 27.664C198.782 26.962 200.316 26.156 201.616 25.246C200.758 24.466 199.744 23.66 198.548 22.828L200.368 21.112ZM226.368 18.408H241.864V26.806H246.258V29.276H242.228L244.282 30.966C242.93 32.63 241.396 33.956 239.68 34.892C241.604 36.296 243.84 37.518 246.388 38.61L245.01 41.002C241.37 39.286 238.432 37.232 236.196 34.814V38.974C236.196 40.794 235.39 41.73 233.804 41.73H230.762L230.164 39.182C231.1 39.286 232.01 39.364 232.894 39.364C233.284 39.364 233.492 39 233.492 38.324V34.918C230.944 37.154 227.928 39.156 224.47 40.95L223.378 38.428C227.278 36.66 230.632 34.58 233.492 32.136V29.276H223.768V26.806H239.108V25.012H227.252V22.672H239.108V20.852H226.368V18.408ZM227.018 29.666C228.526 30.706 229.8 31.746 230.84 32.786L229.072 34.554C228.162 33.566 226.888 32.526 225.224 31.382L227.018 29.666ZM242.176 29.276H236.196V31.824C236.69 32.37 237.236 32.89 237.834 33.41C239.498 32.422 240.954 31.044 242.176 29.276Z"},null,-1)])],2)]))]),t("div",X,[t("div",Y,[t("div",e2,[v(n,{ref_key:"emailInput",ref:d,modelValue:o.email,"onUpdate:modelValue":e[2]||(e[2]=i=>o.email=i),placeholder:"请输入邮箱地址",class:"email-input",type:"email",onKeyup:B(Z,["enter"])},null,8,["modelValue"]),a.email?(H(),c("div",s2,f(a.email),1)):w("",!0)]),r.value==="email"?(H(),c("div",o2,[v(n,{ref_key:"codeInput",ref:C,modelValue:o.code,"onUpdate:modelValue":e[3]||(e[3]=i=>o.code=i),placeholder:"请输入验证码",class:"code-input",onKeyup:B(Z,["enter"])},{suffix:k(()=>[t("span",{class:E(["get-code-text",{disabled:p.value>0||!_.value}]),onClick:P},f(p.value>0?`${p.value}s`:"获取验证码"),3)]),_:1},8,["modelValue"]),a.code?(H(),c("div",a2,f(a.code),1)):w("",!0)])):w("",!0),r.value==="password"?(H(),c("div",t2,[v(n,{ref_key:"passwordInput",ref:V,modelValue:o.password,"onUpdate:modelValue":e[4]||(e[4]=i=>o.password=i),placeholder:"请输入密码","show-password":"",onKeyup:B(Z,["enter"])},null,8,["modelValue"]),a.password?(H(),c("div",l2,f(a.password),1)):w("",!0)])):w("",!0)]),v(s,{type:"primary",class:"login-button",loading:N(g).loading,onClick:Z},{default:k(()=>[M(f(N(g).loading?"登录中...":r.value==="password"?"登录":"登陆/注册"),1)]),_:1},8,["loading"]),t("p",r2,[e[10]||(e[10]=M(" 登录即表示您同意遵守",-1)),v(l,{to:"/user-agreement",class:"agreement-link"},{default:k(()=>[...e[8]||(e[8]=[M("用户协议",-1)])]),_:1}),e[11]||(e[11]=M("和",-1)),v(l,{to:"/privacy-policy",class:"agreement-link"},{default:k(()=>[...e[9]||(e[9]=[M("隐私政策",-1)])]),_:1})])])])])}}},H2=R(n2,[["__scopeId","data-v-97be1832"]]);export{H2 as default};
|