mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
2 lines
5.1 KiB
JavaScript
2 lines
5.1 KiB
JavaScript
import{c as b,i as R}from"./index-BpWtOFbq.chunk.mjs";import{_ as V,g as x,l as $}from"./public-C1mLBHT3.chunk.mjs";import{P as B,a as O}from"./index-BeaM7LiW.chunk.mjs";import{b as w,o as s,f as y,g as t,t as r,y as n,c as p,u as e,k as d,w as _,n as q,F as C,B as P,h as A,j as v,N as T,l as k,e as j}from"./preload-helper-CX9gtE7n.chunk.mjs";import{t as a}from"./translation-DoG5ZELJ-CPJIGC2H.chunk.mjs";import{b as S}from"./index-CziSTDUD.chunk.mjs";import{N}from"./ArrowRight-JDdFcric.chunk.mjs";import{N as g}from"./mdi-BjKyjJ9m.chunk.mjs";import{N as z}from"./ContentCopy-DS0QzQtq.chunk.mjs";import{_ as I}from"./NcTextField.vue_vue_type_script_setup_true_lang-B-4HNjYH-CTxKDSgI.chunk.mjs";import{N as E}from"./NcPasswordField-BOLzDHBJ-Ocef6zuk.chunk.mjs";import{D as F}from"./TrashCanOutline-B-GxU5E3.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./util-BUyb4W9M.chunk.mjs";import"./index-C6zIcU-d.chunk.mjs";import"./NcModal-kyWZ3UFC-CV6Hvf6d.chunk.mjs";import"./Web-lLWc6zap.chunk.mjs";import"./NcInputField-CPL-a_MM-WQA5jsOf.chunk.mjs";const G={key:1},H=w({__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:n(u.$style.oAuthItem__code)},r(c.client.redirectUri),3)]),t("td",null,[t("code",{class:n(u.$style.oAuthItem__code)},r(c.client.clientId),3)]),t("td",null,[c.client.clientSecret?(s(),p(e(E),{key:0,class:n(u.$style.oAuthItem__clientSecret),"aria-label":e(a)("oauth2","Secret key"),asText:"",modelValue:c.client.clientSecret,showTrailingButton:""},null,8,["class","aria-label","modelValue"])):(s(),y("span",G,"*****"))]),t("td",null,[d(e(N),{"aria-label":e(a)("oauth2","Delete"),title:e(a)("oauth2","Delete"),variant:"error",onClick:h[0]||(h[0]=U=>u.$emit("delete"))},{icon:_(()=>[d(F,{size:20})]),_:1},8,["aria-label","title"])])]))}}),J="_oAuthItem__code_3r02l_2",K="_oAuthItem__clientSecret_3r02l_11",L={oAuthItem__code:J,oAuthItem__clientSecret:K},Q={$style:L},W=V(H,[["__cssModules",Q]]),X={class:"hidden-visually"},Y=w({__name:"AdminSettings",props:{modelValue:{required:!0},modelModifiers:{}},emits:["update:modelValue"],setup(c){const u=q(c,"modelValue"),h=x().theming.name,U=$("oauth2","oauth2-doc-link"),f=k(!1),o=k({name:"",redirectUri:"",errorMsg:"",error:!1});async function M(l){await b.delete(S("apps/oauth2/clients/{id}",{id:l})),u.value=u.value.filter(i=>i.id!==l)}async function D(){o.value.error=!1;try{const{data:l}=await b.post(S("apps/oauth2/clients"),{name:o.value.name,redirectUri:o.value.redirectUri},{confirmPassword:B.Strict});u.value.push(l),f.value=!0,o.value.name="",o.value.redirectUri=""}catch(l){o.value.error=!0,R(l)&&l.response?o.value.errorMsg=l.response.data.message:o.value.errorMsg=a("oauth2","An unknown error occurred.")}}return(l,i)=>(s(),p(e(z),{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)}),docUrl:e(U)},{default:_(()=>[u.value.length>0?(s(),y("table",{key:0,class:n([l.$style.oauthApp__table,{[l.$style.oauthApp__table_withSecret]:f.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",X,r(e(a)("oauth2","Delete client")),1)])])]),t("tbody",null,[(s(!0),y(C,null,P(u.value,m=>(s(),p(W,{key:m.id,client:m,onDelete:ie=>M(m.id)},null,8,["client","onDelete"]))),128))])],2)):A("",!0),f.value?(s(),p(e(g),{key:1,type:"warning"},{default:_(()=>[v(r(e(a)("oauth2","Make sure you store the secret key, it cannot be recovered.")),1)]),_:1})):A("",!0),i[2]||(i[2]=t("br",null,null,-1)),t("h3",null,r(e(a)("oauth2","Add client")),1),o.value.error?(s(),p(e(g),{key:2,type:"error"},{default:_(()=>[v(r(o.value.errorMsg),1)]),_:1})):A("",!0),t("form",{class:n(l.$style.oauthApp__form),onSubmit:T(D,["prevent"])},[d(e(I),{id:"name",modelValue:o.value.name,"onUpdate:modelValue":i[0]||(i[0]=m=>o.value.name=m),class:n(l.$style.oauthApp__form__input),name:"name",label:e(a)("oauth2","Name"),placeholder:e(a)("oauth2","Name")},null,8,["modelValue","class","label","placeholder"]),d(e(I),{id:"redirectUri",modelValue:o.value.redirectUri,"onUpdate:modelValue":i[1]||(i[1]=m=>o.value.redirectUri=m),type:"url",class:n(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"]),d(e(N),{type:"submit",class:n(l.$style.oauthApp__submitButton)},{default:_(()=>[v(r(e(a)("oauth2","Add")),1)]),_:1},8,["class"])],34)]),_:1},8,["name","description","docUrl"]))}}),Z="_oauthApp__form_10pnp_1",ee="_oauthApp__form__input_10pnp_6",te="_oauthApp__table_10pnp_11",ae="_oauthApp__table_withSecret_10pnp_38",le={oauthApp__form:Z,oauthApp__form__input:ee,oauthApp__table:te,oauthApp__table_withSecret:ae},oe={$style:le},re=V(Y,[["__cssModules",oe]]);O(b);const ue=$("oauth2","clients"),se=j(re,{modelValue:ue});se.mount("#oauth2");
|
|
//# sourceMappingURL=oauth2-settings-admin.mjs.map
|