"use strict";(self["webpackChunkdatabasir"]=self["webpackChunkdatabasir"]||[]).push([[139],{38787:function(n,t,e){e.d(t,{aF:function(){return o},nK:function(){return a},Hj:function(){return p},Jp:function(){return l},FO:function(){return f},ri:function(){return c},KT:function(){return s}});var r=e(63872),u="/oauth2",o=function(){return r.Z.get(u+"/apps")},a=function(n,t){return r.Z.get(u+"/authorization/"+n,{params:t})},i="/api/v1.0/oauth2_apps",p=function(n){return r.Z.get(i,{params:n})},l=function(n){return r.Z["delete"](i+"/"+n)},f=function(n){return r.Z.get(i+"/"+n)},c=function(n){return r.Z.post(i,n)},s=function(n){return r.Z.patch(i,n)}},1082:function(n,t,e){e.d(t,{Z:function(){return c}});var r=e(66252),u=e(3577),o=["src"],a=["src"];function i(n,t,i,p,l,f){var c=(0,r.up)("el-tooltip");return"github"==i.appType.toLowerCase()?((0,r.wg)(),(0,r.j4)(c,{key:0,content:i.appName,effect:"light"},{default:(0,r.w5)((function(){return[(0,r._)("img",{src:i.appIcon?i.appIcon:e(39710),style:{"max-width":"20px","max-height":"20px"}},null,8,o)]})),_:1},8,["content"])):"gitlab"==i.appType.toLowerCase()?((0,r.wg)(),(0,r.j4)(c,{key:1,content:i.appName,effect:"light"},{default:(0,r.w5)((function(){return[(0,r._)("img",{src:i.appIcon?i.appIcon:e(84386),style:{"max-width":"20px","max-height":"20px"}},null,8,a)]})),_:1},8,["content"])):((0,r.wg)(),(0,r.iD)(r.HY,{key:2},[(0,r.Uk)((0,u.zw)(i.appType),1)],64))}var p={props:{appType:String,appIcon:String,appName:String}},l=e(83744);const f=(0,l.Z)(p,[["render",i]]);var c=f},41139:function(n,t,e){e.r(t),e.d(t,{default:function(){return w}});var r=e(66252),u=e(49963),o={class:"login-card"},a=(0,r._)("h1",null,"Databasir",-1),i=(0,r.Uk)(" 登录 "),p=(0,r.Uk)(" 忘记密码? ");function l(n,t,e,l,f,c){var s=(0,r.up)("el-header"),d=(0,r.up)("el-link"),m=(0,r.up)("el-divider"),g=(0,r.up)("el-form-item"),h=(0,r.up)("el-button"),w=(0,r.up)("el-tooltip"),_=(0,r.up)("el-space"),y=(0,r.up)("oauth2-app-type"),v=(0,r.up)("el-form"),k=(0,r.up)("el-main"),b=(0,r.up)("el-footer"),W=(0,r.up)("el-container");return(0,r.wg)(),(0,r.j4)(W,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(s),(0,r.Wm)(k,{class:"login-main"},{default:(0,r.w5)((function(){return[(0,r._)("div",o,[(0,r.Wm)(v,{ref:"formRef",rules:f.formRule,model:f.form,style:{border:"none"}},{default:(0,r.w5)((function(){return[(0,r.Wm)(g,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(m,{"content-position":"left"},{default:(0,r.w5)((function(){return[(0,r.Wm)(d,{href:"https://github.com/vran-dev/databasir",target:"_blank",underline:!1,type:"info"},{default:(0,r.w5)((function(){return[a]})),_:1})]})),_:1})]})),_:1}),(0,r.Wm)(g,{prop:"username"},{default:(0,r.w5)((function(){return[(0,r.wy)((0,r._)("input",{type:"text",class:"login-input",placeholder:"用户名或邮箱","onUpdate:modelValue":t[0]||(t[0]=function(n){return f.form.username=n}),onKeyup:t[1]||(t[1]=(0,u.D2)((function(n){return c.onLogin("formRef")}),["enter"]))},null,544),[[u.nr,f.form.username]])]})),_:1}),(0,r.Wm)(g,{prop:"password"},{default:(0,r.w5)((function(){return[(0,r.wy)((0,r._)("input",{type:"password",class:"login-input",placeholder:"密码","onUpdate:modelValue":t[2]||(t[2]=function(n){return f.form.password=n}),onKeyup:t[3]||(t[3]=(0,u.D2)((function(n){return c.onLogin("formRef")}),["enter"]))},null,544),[[u.nr,f.form.password]])]})),_:1}),(0,r.Wm)(g,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(_,{size:32},{default:(0,r.w5)((function(){return[(0,r.Wm)(h,{style:{width:"120px","margin-top":"10px"},color:"#000",onClick:t[4]||(t[4]=function(n){return c.onLogin("formRef")}),plain:"",round:""},{default:(0,r.w5)((function(){return[i]})),_:1}),(0,r.Wm)(w,{content:"请联系管理员为您重置密码"},{default:(0,r.w5)((function(){return[(0,r.Wm)(d,{target:"_blank",underline:!1,type:"info"},{default:(0,r.w5)((function(){return[p]})),_:1})]})),_:1})]})),_:1})]})),_:1}),(0,r.Wm)(g,null,{default:(0,r.w5)((function(){return[f.oauthApps.length>0?((0,r.wg)(),(0,r.j4)(m,{key:0,"content-position":"right"},{default:(0,r.w5)((function(){return[(0,r.Wm)(_,{size:26},{default:(0,r.w5)((function(){return[((0,r.wg)(!0),(0,r.iD)(r.HY,null,(0,r.Ko)(f.oauthApps,(function(n,t){return(0,r.wg)(),(0,r.j4)(d,{key:t,underline:!1,onClick:function(t){return c.onAuthLogin(n.registrationId)}},{default:(0,r.w5)((function(){return[(0,r.Wm)(y,{"app-type":n.appType,"app-icon":n.appIcon,"app-name":n.appName},null,8,["app-type","app-icon","app-name"])]})),_:2},1032,["onClick"])})),128))]})),_:1})]})),_:1})):(0,r.kq)("",!0)]})),_:1})]})),_:1},8,["rules","model"])])]})),_:1}),(0,r.Wm)(b,null,{default:(0,r.w5)((function(){return[(0,r.Wm)(_)]})),_:1})]})),_:1})}var f=e(40152),c=e(51836),s=e(38787),d=e(1082),m={components:{Oauth2AppType:d.Z},data:function(){return{form:{username:null,password:null},formRule:{username:[{required:!0,message:"请输入用户名或邮箱",trigger:"blur"}],password:[{required:!0,message:"请输入密码",trigger:"blur"}]},oauthApps:[]}},created:function(){this.fetchAllOAuthApps()},methods:{resolveAppIcon:function(n){return n.appIcon&&""!=n.appIcon?n.appIcon:"github"==n.appType?e(39710):"gitlab"==n.appType?e(84386):""},fetchAllOAuthApps:function(){var n=this;(0,s.aF)().then((function(t){t.errCode||(n.oauthApps=t.data)}))},toIndexPage:function(){this.$router.push({path:"/groups"})},onAuthLogin:function(n){var t=window.location.protocol,e=t+"//"+window.location.host+"/login/oauth2/"+n,r={redirect_uri:e};(0,s.nK)(n,r).then((function(n){n.errCode||(window.location.href=n.data)}))},onLogin:function(){var n=this;this.$refs.formRef.validate((function(t){t&&(0,f.x4)(n.form).then((function(t){t.errCode||(c.E.saveUserLoginData(t.data),n.$store.commit("userUpdate",{nickname:t.data.nickname,username:t.data.username,email:t.data.email}),n.toIndexPage())}))}))}}},g=e(83744);const h=(0,g.Z)(m,[["render",l]]);var w=h},39710:function(n,t,e){n.exports=e.p+"img/github.e45f4724.svg"},84386:function(n,t,e){n.exports=e.p+"img/gitlab.6b1155ee.svg"}}]); //# sourceMappingURL=139-legacy.29a694c8.js.map