mirror of
https://github.com/nextcloud/server.git
synced 2026-04-28 09:37:29 -04:00
2 lines
4.7 KiB
JavaScript
2 lines
4.7 KiB
JavaScript
import{j as $,E as y,o as s,H as t,f as r,G as i,c as d,y as e,t as a,b as p,w as m,u as R,n as O,l as w,q as k,F as A,M as q,N as x,e as b,O as C,h as j}from"./mdi-B9XVyi7B.chunk.mjs";import{c as g,i as z}from"./index-BOuI_nzB.chunk.mjs";import{_ as V,d as U}from"./_plugin-vue_export-helper-CDPKodk-.chunk.mjs";import{b as M,e as I}from"./NcNoteCard-CVhtNL04-BSciYEDO.chunk.mjs";import{N as B}from"./ContentCopy-CFmC6HSf.chunk.mjs";import{D as E,_ as S}from"./TrashCanOutline-u_08oBcy.chunk.mjs";import{N as F}from"./NcPasswordField-djttkA5Q-BxuGevvX.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./string_decoder-mL5xNZ9K.chunk.mjs";import"./NcInputField-Bwsh2aHY-kbXSi5f0.chunk.mjs";const G={key:1},H=$({__name:"OAuthItem",props:{client:{}},emits:["delete"],setup(c){return(u,h)=>(s(),y("tr",null,[t("td",null,r(c.client.name),1),t("td",null,[t("code",{class:i(u.$style.oAuthItem__code)},r(c.client.redirectUri),3)]),t("td",null,[t("code",{class:i(u.$style.oAuthItem__code)},r(c.client.clientId),3)]),t("td",null,[c.client.clientSecret?(s(),d(e(F),{key:0,class:i(u.$style.oAuthItem__clientSecret),"aria-label":e(a)("oauth2","Secret key"),"as-text":"","model-value":c.client.clientSecret,"show-trailing-button":""},null,8,["class","aria-label","model-value"])):(s(),y("span",G,"*****"))]),t("td",null,[p(e(M),{"aria-label":e(a)("oauth2","Delete"),title:e(a)("oauth2","Delete"),variant:"error",onClick:h[0]||(h[0]=f=>u.$emit("delete"))},{icon:m(()=>[p(E,{size:20})]),_:1},8,["aria-label","title"])])]))}}),J="_oAuthItem__code_3r02l_2",K="_oAuthItem__clientSecret_3r02l_11",L={oAuthItem__code:J,oAuthItem__clientSecret:K},P={$style:L},Q=V(H,[["__cssModules",P]]),T={class:"hidden-visually"},W=$({__name:"AdminSettings",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(c){const u=R(c,"modelValue"),h=O().theming.name,f=w("oauth2","oauth2-doc-link"),v=k(!1),o=k({name:"",redirectUri:"",errorMsg:"",error:!1});async function N(l){await g.delete(U("apps/oauth2/clients/{id}",{id:l})),u.value=u.value.filter(n=>n.id!==l)}async function D(){o.value.error=!1;try{const{data:l}=await g.post(U("apps/oauth2/clients"),{name:o.value.name,redirectUri:o.value.redirectUri});u.value.push(l),v.value=!0,o.value.name="",o.value.redirectUri=""}catch(l){o.value.error=!0,z(l)&&l.response?o.value.errorMsg=l.response.data.message:o.value.errorMsg=a("oauth2","An unknown error occurred.")}}return(l,n)=>(s(),d(e(B),{name:e(a)("oauth2","OAuth 2.0 clients"),description:e(a)("oauth2","OAuth 2.0 allows external services to request access to {instanceName}.",{instanceName:e(h)}),"doc-url":e(f)},{default:m(()=>[u.value.length>0?(s(),y("table",{key:0,class:i([l.$style.oauthApp__table,{[l.$style.oauthApp__table_withSecret]:v.value}])},[t("thead",null,[t("tr",null,[t("th",null,r(e(a)("oauth2","Name")),1),t("th",null,r(e(a)("oauth2","Redirection URI")),1),t("th",null,r(e(a)("oauth2","Client identifier")),1),t("th",null,r(e(a)("oauth2","Secret key")),1),t("th",null,[t("span",T,r(e(a)("oauth2","Delete client")),1)])])]),t("tbody",null,[(s(!0),y(q,null,x(u.value,_=>(s(),d(Q,{key:_.id,client:_,onDelete:ue=>N(_.id)},null,8,["client","onDelete"]))),128))])],2)):A("",!0),v.value?(s(),d(e(I),{key:1,type:"warning"},{default:m(()=>[b(r(e(a)("oauth2","Make sure you store the secret key, it cannot be recovered.")),1)]),_:1})):A("",!0),n[2]||(n[2]=t("br",null,null,-1)),t("h3",null,r(e(a)("oauth2","Add client")),1),o.value.error?(s(),d(e(I),{key:2,type:"error"},{default:m(()=>[b(r(o.value.errorMsg),1)]),_:1})):A("",!0),t("form",{class:i(l.$style.oauthApp__form),onSubmit:C(D,["prevent"])},[p(e(S),{id:"name",modelValue:o.value.name,"onUpdate:modelValue":n[0]||(n[0]=_=>o.value.name=_),class:i(l.$style.oauthApp__form__input),name:"name",label:e(a)("oauth2","Name"),placeholder:e(a)("oauth2","Name")},null,8,["modelValue","class","label","placeholder"]),p(e(S),{id:"redirectUri",modelValue:o.value.redirectUri,"onUpdate:modelValue":n[1]||(n[1]=_=>o.value.redirectUri=_),type:"url",class:i(l.$style.oauthApp__form__input),name:"redirectUri",label:e(a)("oauth2","Redirection URI"),placeholder:e(a)("oauth2","Redirection URI")},null,8,["modelValue","class","label","placeholder"]),p(e(M),{type:"submit",class:i(l.$style.oauthApp__submitButton)},{default:m(()=>[b(r(e(a)("oauth2","Add")),1)]),_:1},8,["class"])],34)]),_:1},8,["name","description","doc-url"]))}}),X="_oauthApp__form_15nkg_1",Y="_oauthApp__form__input_15nkg_6",Z="_oauthApp__table_15nkg_11",ee="_oauthApp__table_withSecret_15nkg_38",te={oauthApp__form:X,oauthApp__form__input:Y,oauthApp__table:Z,oauthApp__table_withSecret:ee},ae={$style:te},le=V(W,[["__cssModules",ae]]),oe=w("oauth2","clients"),re=j(le,{modelValue:oe});re.mount("#oauth2");
|
|
//# sourceMappingURL=oauth2-settings-admin.mjs.map
|