nextcloud-server/dist/7145-7145.js

2 lines
3.4 KiB
JavaScript

"use strict";(globalThis.webpackChunknextcloud_ui_legacy=globalThis.webpackChunknextcloud_ui_legacy||[]).push([[7145],{17859:(e,t,a)=>{a.d(t,{A:()=>n._});var n=a(66980)},39526:(e,t,a)=>{a.r(t),a.d(t,{default:()=>f});var n=a(20641),l=a(50953),i=a(90033),u=a(21777),r=a(80474),o=a(91126),s=a(64572),c=a(17859),m=a(31890),d=a(64666),p=a(50240);function v(e){if(""===e.trim())return(0,m.t)("Names must not be empty.");if(e.startsWith("."))return(0,m.t)("Names must not start with a dot.");if(e.length>64)return(0,m.t)("Names may be at most 64 characters long.");try{return(0,d.KT)(e),""}catch(e){if(!(e instanceof d.di))throw e;switch(e.reason){case d.nF.Character:return(0,m.t)('"{char}" is not allowed inside a name.',{char:e.segment});case d.nF.ReservedName:return(0,m.t)('"{segment}" is a reserved name and not allowed.',{segment:e.segment});case d.nF.Extension:return e.segment.match(/\.[a-z]/i)?(0,m.t)('"{extension}" is not an allowed name.',{extension:e.segment}):(0,m.t)('Names must not end with "{extension}".',{extension:e.segment});default:return(0,m.t)("Invalid name.")}}}const b={key:0,class:"public-auth-prompt__text"},h=(0,n.pM)({__name:"PublicAuthPrompt",props:{nickname:{default:""},title:{default:(0,m.t)("Guest identification")},text:{default:""},notice:{default:""},submitLabel:{default:(0,m.t)("Submit name")},cancellable:{type:Boolean}},emits:["close"],setup(e,{emit:t}){const a=e,d=t,p=(0,n.rk)("input"),h=(0,r.c0)("public").build(),f=(0,l.KR)(a.nickname);(0,n.wB)(()=>a.nickname,()=>{f.value=a.nickname}),(0,n.wB)(f,e=>{const t=v(e);if(!t)return p.value.setCustomValidity(t),p.value.reportValidity(),void p.value.focus()});const y=(0,n.EW)(()=>{const e={label:(0,m.t)("Cancel"),variant:"tertiary",callback:()=>d("close")},t={label:a.submitLabel,type:"submit",variant:"primary"};return a.cancellable?[e,t]:[t]}),g=(0,n.EW)(()=>a.notice?a.notice:f.value?(0,m.t)("You are currently identified as {nickname}.",{nickname:f.value}):(0,m.t)("You are currently not identified."));function _(){const e=f.value.trim(),t=v(e);if(t)return p.value.setCustomValidity(t),p.value.reportValidity(),void p.value.focus();if(""===e)return p.value.setCustomValidity((0,m.t)("You cannot leave the name empty.")),p.value.reportValidity(),void p.value.focus();if(e.length<2)return p.value.setCustomValidity((0,m.t)("Please enter a name with at least 2 characters.")),p.value.reportValidity(),void p.value.focus();try{(0,u.L$)(e)}catch(e){return m.l.error("Failed to set nickname",{error:e}),(0,m.s)((0,m.t)("Failed to set nickname.")),void p.value.focus()}h.setItem("public-auth-prompt-shown","true"),d("close",f.value)}return(t,a)=>((0,n.uX)(),(0,n.Wv)((0,l.R1)(o.A),{buttons:y.value,class:"public-auth-prompt","data-cy-public-auth-prompt-dialog":"","is-form":"","no-close":"",name:e.title,onSubmit:_},{default:(0,n.k6)(()=>[e.text?((0,n.uX)(),(0,n.CE)("p",b,(0,i.v_)(e.text),1)):(0,n.Q3)("",!0),(0,n.bF)((0,l.R1)(s.A),{class:"public-auth-prompt__header",text:g.value,type:"info"},null,8,["text"]),(0,n.bF)((0,l.R1)(c.A),{ref:"input",modelValue:f.value,"onUpdate:modelValue":a[0]||(a[0]=e=>f.value=e),class:"public-auth-prompt__input","data-cy-public-auth-prompt-dialog-name":"",label:(0,l.R1)(m.t)("Name"),placeholder:(0,l.R1)(m.t)("Enter your name"),required:!e.cancellable,minlength:"2",maxlength:"64",name:"name"},null,8,["modelValue","label","placeholder","required"])]),_:1},8,["buttons","name"]))}}),f=(0,p._)(h,[["__scopeId","data-v-b33d88e5"]])}}]);
//# sourceMappingURL=7145-7145.js.map?v=d9c518ca34bfdbd7ff70