From 8eab1fedfe64e17d1bfadca3f26da913a8bd9347 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 3 Nov 2021 10:49:45 +0100 Subject: [PATCH] Properly apply the username prefill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- core/js/dist/login.js | 4 ++-- core/js/dist/login.js.map | 2 +- core/src/views/Login.vue | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/js/dist/login.js b/core/js/dist/login.js index 6421a4be60a..dab15c912ac 100644 --- a/core/js/dist/login.js +++ b/core/js/dist/login.js @@ -906,7 +906,7 @@ e.defineLocale("zh-tw",{months:"一月_二月_三月_四月_五月_六月_七月 */ const u=o.Model.extend({defaults:{fullName:"",lastMessage:"",actions:[],hasOneAction:!1,hasTwoActions:!1,hasManyActions:!1},initialize:function(){0===this.get("actions").length?this.set("hasOneAction",!0):1===this.get("actions").length?(this.set("hasTwoActions",!0),this.set("secondAction",this.get("actions")[0])):this.set("hasManyActions",!0)}}),l=o.Collection.extend({model:u}),c=o.View.extend({_collection:void 0,_subViews:[],initialize:function(e){this._collection=e.collection},render:function(){var e=this;return e.$el.html(""),e._subViews=[],e._collection.forEach((function(t){var n=new d({model:t});n.render(),e.$el.append(n.$el),n.on("toggle:actionmenu",e._onChildActionMenuToggle,e),e._subViews.push(n)})),e},_onChildActionMenuToggle:function(e){this._subViews.forEach((function(t){t.trigger("parent:toggle:actionmenu",e)}))}}),d=o.View.extend({className:"contact",_template:void 0,_model:void 0,_actionMenuShown:!1,events:{"click .icon-more":"_onToggleActionsMenu"},contactTemplate:r(563),template:function(e){return this.contactTemplate(e)},initialize:function(e){this._model=e.model,this.on("parent:toggle:actionmenu",this._onOtherActionMenuOpened,this)},render:function(){return this.$el.html(this.template({contact:this._model.toJSON()})),this.delegateEvents(),this.$("div.avatar").imageplaceholder(this._model.get("fullName")),this.$(".top-action").tooltip({placement:"left"}),this.$(".second-action").tooltip({placement:"left"}),this},_onToggleActionsMenu:function(){this._actionMenuShown=!this._actionMenuShown,this._actionMenuShown?this.$(".menu").show():this.$(".menu").hide(),this.trigger("toggle:actionmenu",this.$el)},_onOtherActionMenuOpened:function(e){this.$el.is(e)||(this._actionMenuShown=!1,this.$(".menu").hide())}}),f=o.View.extend({_loadingTemplate:void 0,_errorTemplate:void 0,_contentTemplate:void 0,_contactsTemplate:void 0,_contacts:void 0,_searchTerm:"",events:{"input #contactsmenu-search":"_onSearch"},templates:{loading:r(578),error:r(579),menu:r(580),list:r(581)},_onSearch:e.debounce((function(e){var t=this.$("#contactsmenu-search").val();t!==this._searchTerm&&(this.trigger("search",this.$("#contactsmenu-search").val()),this._searchTerm=t)}),700),loadingTemplate:function(e){return this.templates.loading(e)},errorTemplate:function(n){return this.templates.error(e.extend({couldNotLoadText:t("core","Could not load your contacts")},n))},contentTemplate:function(n){return this.templates.menu(e.extend({searchContactsText:t("core","Search contacts …")},n))},contactsTemplate:function(n){return this.templates.list(e.extend({noContactsFoundText:t("core","No contacts found"),showAllContactsText:t("core","Show all contacts …"),contactsAppMgmtText:t("core","Install the Contacts app")},n))},initialize:function(e){this.options=e},showLoading:function(e){this.render(),this._contacts=void 0,this.$(".content").html(this.loadingTemplate({loadingText:e}))},showError:function(){this.render(),this._contacts=void 0,this.$(".content").html(this.errorTemplate())},showContacts:function(e,t){this._contacts=e.contacts,this.render({contacts:e.contacts});var n=new c({collection:e.contacts});n.render(),this.$(".content").html(this.contactsTemplate({contacts:e.contacts,searchTerm:t,contactsAppEnabled:e.contactsAppEnabled,contactsAppURL:s.a.generateUrl("/apps/contacts"),canInstallApp:s.a.isUserAdmin(),contactsAppMgmtURL:s.a.generateUrl("/settings/apps/social/contacts")})),this.$("#contactsmenu-contacts").html(n.$el)},render:function(e){var t=this.$("#contactsmenu-search").val();return this.$el.html(this.contentTemplate(e)),this.$("#contactsmenu-search").val(t),this.$("#contactsmenu-search").focus(),this}}),p=function(e){this.initialize(e)};p.prototype={$el:void 0,_$trigger:void 0,_view:void 0,_contactsPromise:void 0,initialize:function(e){this.$el=e.el,this._$trigger=e.trigger,this._view=new f({el:this.$el}),this._view.on("search",(function(e){this._loadContacts(e)}),this),s.a.registerMenu(this._$trigger,this.$el,function(){this._toggleVisibility(!0)}.bind(this),!0),this.$el.on("beforeHide",function(){this._toggleVisibility(!1)}.bind(this))},_toggleVisibility:function(e){return e?this._loadContacts():(this.$el.html(""),Promise.resolve())},_getContacts:function(e){var t=s.a.generateUrl("/contactsmenu/contacts");return Promise.resolve(i.a.ajax(t,{method:"POST",data:{filter:e}}))},_loadContacts:function(n){var r=this;return r._contactsPromise||(r._contactsPromise=r._getContacts(n)),e.isUndefined(n)||""===n?r._view.showLoading(t("core","Loading your contacts …")):r._view.showLoading(t("core","Looking for {term} …",{term:n})),r._contactsPromise.then((function(e){e.contacts=new l(e.contacts),r._view.showContacts(e,n)}),(function(e){r._view.showError(),console.error("There was an error loading your contacts",e)})).then((function(){delete r._contactsPromise})).catch(console.error.bind(this))}},n.a=p}).call(this,r(8))},function(e,t,n){ /*! @license DOMPurify 2.3.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.3.4/LICENSE */ -e.exports=function(){"use strict";var e=Object.hasOwnProperty,t=Object.setPrototypeOf,n=Object.isFrozen,r=Object.getPrototypeOf,a=Object.getOwnPropertyDescriptor,i=Object.freeze,o=Object.seal,s=Object.create,u="undefined"!=typeof Reflect&&Reflect,l=u.apply,c=u.construct;l||(l=function(e,t,n){return e.apply(t,n)}),i||(i=function(e){return e}),o||(o=function(e){return e}),c||(c=function(e,t){return new(Function.prototype.bind.apply(e,[null].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t1?n-1:0),a=1;a/gm),F=o(/^data-[\-\w.\u00B7-\uFFFF]/),R=o(/^aria-[\-\w]+$/),U=o(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),W=o(/^(?:\w+script|data):/i),z=o(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),$="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};function B(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:G(),n=function(t){return e(t)};if(n.version="2.3.4",n.removed=[],!t||!t.document||9!==t.document.nodeType)return n.isSupported=!1,n;var r=t.document,a=t.document,o=t.DocumentFragment,s=t.HTMLTemplateElement,u=t.Node,l=t.Element,c=t.NodeFilter,d=t.NamedNodeMap,w=void 0===d?t.NamedNodeMap||t.MozNamedAttrMap:d,V=t.HTMLFormElement,J=t.DOMParser,K=t.trustedTypes,X=l.prototype,Z=x(X,"cloneNode"),Q=x(X,"nextSibling"),ee=x(X,"childNodes"),te=x(X,"parentNode");if("function"==typeof s){var ne=a.createElement("template");ne.content&&ne.content.ownerDocument&&(a=ne.content.ownerDocument)}var re=q(K,r),ae=re&&He?re.createHTML(""):"",ie=a,oe=ie.implementation,se=ie.createNodeIterator,ue=ie.createDocumentFragment,le=ie.getElementsByTagName,ce=r.importNode,de={};try{de=T(a).documentMode?a.documentMode:{}}catch(e){}var fe={};n.isSupported="function"==typeof te&&oe&&void 0!==oe.createHTMLDocument&&9!==de;var pe=N,me=I,he=F,_e=R,ge=W,ye=z,ve=U,Me=null,Le=b({},[].concat(B(k),B(Y),B(D),B(E),B(j))),we=null,be=b({},[].concat(B(O),B(P),B(C),B(H))),Te=Object.seal(Object.create(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xe=null,ke=null,Ye=!0,De=!0,Se=!1,Ee=!1,Ae=!1,je=!1,Oe=!1,Pe=!1,Ce=!1,He=!1,Ne=!0,Ie=!0,Fe=!1,Re={},Ue=null,We=b({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ze=null,$e=b({},["audio","video","img","source","image","track"]),Be=null,Ge=b({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),qe="http://www.w3.org/1998/Math/MathML",Ve="http://www.w3.org/2000/svg",Je="http://www.w3.org/1999/xhtml",Ke=Je,Xe=!1,Ze=void 0,Qe=["application/xhtml+xml","text/html"],et="text/html",tt=void 0,nt=null,rt=a.createElement("form"),at=function(e){return e instanceof RegExp||e instanceof Function},it=function(e){nt&&nt===e||(e&&"object"===(void 0===e?"undefined":$(e))||(e={}),e=T(e),Me="ALLOWED_TAGS"in e?b({},e.ALLOWED_TAGS):Le,we="ALLOWED_ATTR"in e?b({},e.ALLOWED_ATTR):be,Be="ADD_URI_SAFE_ATTR"in e?b(T(Ge),e.ADD_URI_SAFE_ATTR):Ge,ze="ADD_DATA_URI_TAGS"in e?b(T($e),e.ADD_DATA_URI_TAGS):$e,Ue="FORBID_CONTENTS"in e?b({},e.FORBID_CONTENTS):We,xe="FORBID_TAGS"in e?b({},e.FORBID_TAGS):{},ke="FORBID_ATTR"in e?b({},e.FORBID_ATTR):{},Re="USE_PROFILES"in e&&e.USE_PROFILES,Ye=!1!==e.ALLOW_ARIA_ATTR,De=!1!==e.ALLOW_DATA_ATTR,Se=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=e.SAFE_FOR_TEMPLATES||!1,Ae=e.WHOLE_DOCUMENT||!1,Pe=e.RETURN_DOM||!1,Ce=e.RETURN_DOM_FRAGMENT||!1,He=e.RETURN_TRUSTED_TYPE||!1,Oe=e.FORCE_BODY||!1,Ne=!1!==e.SANITIZE_DOM,Ie=!1!==e.KEEP_CONTENT,Fe=e.IN_PLACE||!1,ve=e.ALLOWED_URI_REGEXP||ve,Ke=e.NAMESPACE||Je,e.CUSTOM_ELEMENT_HANDLING&&at(e.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Te.tagNameCheck=e.CUSTOM_ELEMENT_HANDLING.tagNameCheck),e.CUSTOM_ELEMENT_HANDLING&&at(e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Te.attributeNameCheck=e.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),e.CUSTOM_ELEMENT_HANDLING&&"boolean"==typeof e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements&&(Te.allowCustomizedBuiltInElements=e.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ze=Ze=-1===Qe.indexOf(e.PARSER_MEDIA_TYPE)?et:e.PARSER_MEDIA_TYPE,tt="application/xhtml+xml"===Ze?function(e){return e}:h,Ee&&(De=!1),Ce&&(Pe=!0),Re&&(Me=b({},[].concat(B(j))),we=[],!0===Re.html&&(b(Me,k),b(we,O)),!0===Re.svg&&(b(Me,Y),b(we,P),b(we,H)),!0===Re.svgFilters&&(b(Me,D),b(we,P),b(we,H)),!0===Re.mathMl&&(b(Me,E),b(we,C),b(we,H))),e.ADD_TAGS&&(Me===Le&&(Me=T(Me)),b(Me,e.ADD_TAGS)),e.ADD_ATTR&&(we===be&&(we=T(we)),b(we,e.ADD_ATTR)),e.ADD_URI_SAFE_ATTR&&b(Be,e.ADD_URI_SAFE_ATTR),e.FORBID_CONTENTS&&(Ue===We&&(Ue=T(Ue)),b(Ue,e.FORBID_CONTENTS)),Ie&&(Me["#text"]=!0),Ae&&b(Me,["html","head","body"]),Me.table&&(b(Me,["tbody"]),delete xe.tbody),i&&i(e),nt=e)},ot=b({},["mi","mo","mn","ms","mtext"]),st=b({},["foreignobject","desc","title","annotation-xml"]),ut=b({},Y);b(ut,D),b(ut,S);var lt=b({},E);b(lt,A);var ct=function(e){var t=te(e);t&&t.tagName||(t={namespaceURI:Je,tagName:"template"});var n=h(e.tagName),r=h(t.tagName);if(e.namespaceURI===Ve)return t.namespaceURI===Je?"svg"===n:t.namespaceURI===qe?"svg"===n&&("annotation-xml"===r||ot[r]):Boolean(ut[n]);if(e.namespaceURI===qe)return t.namespaceURI===Je?"math"===n:t.namespaceURI===Ve?"math"===n&&st[r]:Boolean(lt[n]);if(e.namespaceURI===Je){if(t.namespaceURI===Ve&&!st[r])return!1;if(t.namespaceURI===qe&&!ot[r])return!1;var a=b({},["title","style","font","a","script"]);return!lt[n]&&(a[n]||!ut[n])}return!1},dt=function(e){m(n.removed,{element:e});try{e.parentNode.removeChild(e)}catch(t){try{e.outerHTML=ae}catch(t){e.remove()}}},ft=function(e,t){try{m(n.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){m(n.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e&&!we[e])if(Pe||Ce)try{dt(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},pt=function(e){var t=void 0,n=void 0;if(Oe)e=""+e;else{var r=_(e,/^[\r\n\t ]+/);n=r&&r[0]}"application/xhtml+xml"===Ze&&(e=''+e+"");var i=re?re.createHTML(e):e;if(Ke===Je)try{t=(new J).parseFromString(i,Ze)}catch(e){}if(!t||!t.documentElement){t=oe.createDocument(Ke,"template",null);try{t.documentElement.innerHTML=Xe?"":i}catch(e){}}var o=t.body||t.documentElement;return e&&n&&o.insertBefore(a.createTextNode(n),o.childNodes[0]||null),Ke===Je?le.call(t,Ae?"html":"body")[0]:Ae?t.documentElement:o},mt=function(e){return se.call(e.ownerDocument||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,null,!1)},ht=function(e){return e instanceof V&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof w)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore)},_t=function(e){return"object"===(void 0===u?"undefined":$(u))?e instanceof u:e&&"object"===(void 0===e?"undefined":$(e))&&"number"==typeof e.nodeType&&"string"==typeof e.nodeName},gt=function(e,t,r){fe[e]&&f(fe[e],(function(e){e.call(n,t,r,nt)}))},yt=function(e){var t=void 0;if(gt("beforeSanitizeElements",e,null),ht(e))return dt(e),!0;if(_(e.nodeName,/[\u0080-\uFFFF]/))return dt(e),!0;var r=tt(e.nodeName);if(gt("uponSanitizeElement",e,{tagName:r,allowedTags:Me}),!_t(e.firstElementChild)&&(!_t(e.content)||!_t(e.content.firstElementChild))&&M(/<[/\w]/g,e.innerHTML)&&M(/<[/\w]/g,e.textContent))return dt(e),!0;if("select"===r&&M(/