"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9420],{9420:(e,t,a)=>{a.r(t),a.d(t,{default:()=>h});var r=a(37270),s=a(32446),n=a(88563),l=(a(17046),a(36169),a(3188),a(30973),a(12401),a(59297),a(4290),a(36418)),o=a.n(l),c=a(14778),i=a(85990),m=a(83984),p=a(83007);function u(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class d extends o().PureComponent{constructor(e){super(e),u(this,"handleAllow",(()=>{const e=new URLSearchParams(this.props.location.search),t={responseType:e.get("response_type"),clientId:e.get("client_id"),redirectUri:e.get("redirect_uri"),state:e.get("state"),scope:e.get("store")};this.props.actions.allowOAuth2(t).then((e=>{let{data:t,error:a}=e;t&&t.redirect?window.location.href=t.redirect:a&&this.setState({error:a.message})}))})),u(this,"handleDeny",(()=>{const e=new URLSearchParams(this.props.location.search).get("redirect_uri");e&&(e.startsWith("https://")||e.startsWith("http://"))?window.location.href=e+"?error=access_denied":(0,p.J)().replace("/error")})),this.state={}}componentDidMount(){const e=document.getElementById("antiClickjack");e&&e.parentNode&&e.parentNode.removeChild(e);const t=new URLSearchParams(this.props.location.search).get("client_id");t&&!/^[a-z0-9]+$/.test(t)||this.props.actions.getOAuthAppInfo(t).then((e=>{let{data:t}=e;t&&this.setState({app:t})}))}render(){const e=this.state.app;if(!e)return null;let t,a;return t=e.icon_url?e.icon_url:m,this.state.error&&(a=o().createElement("div",{className:"prompt__error form-group"},o().createElement(i.Ay,{error:this.state.error}))),o().createElement("div",{className:"container-fluid"},o().createElement("div",{className:"prompt"},o().createElement("div",{className:"prompt__heading"},o().createElement("div",{className:"prompt__app-icon"},o().createElement("img",{alt:"prompt icon",src:t,width:"50",height:"50"})),o().createElement("div",{className:"text"},o().createElement(c.FormattedMessage,{id:"authorize.connectTitle",defaultMessage:"Authorize <b>{appName}</b> to Connect to Your <b>Mattermost</b> User Account",values:{appName:e.name,b:e=>o().createElement("b",null,e)}}))),o().createElement("p",null,o().createElement(c.FormattedMessage,{id:"authorize.modificationAccess",defaultMessage:"The app <b>{appName}</b> would like the ability to access and modify your basic information.",values:{appName:e.name,b:e=>o().createElement("b",null,e)}})),o().createElement("h2",{className:"prompt__allow"},o().createElement(c.FormattedMessage,{id:"authorize.allowAccess",defaultMessage:"Allow <b>{appName}</b> access?",values:{appName:e.name,b:e=>o().createElement("b",null,e)}})),o().createElement("div",{className:"prompt__buttons"},o().createElement("button",{type:"submit",className:"btn btn-tertiary authorize-btn",onClick:this.handleDeny},o().createElement(c.FormattedMessage,{id:"authorize.deny",defaultMessage:"Deny"})),o().createElement("button",{type:"submit",className:"btn btn-primary authorize-btn",onClick:this.handleAllow},o().createElement(c.FormattedMessage,{id:"authorize.allow",defaultMessage:"Allow"}))),a))}}const h=(0,r.connect)(null,(function(e){return{actions:(0,s.zH)({getOAuthAppInfo:n.LB,allowOAuth2:n.hg},e)}}))(d)},85990:(e,t,a)=>{a.d(t,{Ay:()=>m,Nq:()=>o});var r=a(62688),s=a.n(r),n=(a(17046),a(36418)),l=a.n(n);const o="backstage",c=[],i=e=>{let{error:t=null,errors:a=c,iconClassName:r,margin:s,textClassName:n,type:i}=e;if(!t&&0===a.length)return null;let m=t;if(!m)for(const e of a)e&&(m=e);return m?"modal"===i?l().createElement("div",{className:"form-group"},l().createElement("label",{className:"col-sm-12 has-error"},m)):i===o?l().createElement("div",{className:"pull-left has-error"},l().createElement("label",{className:"control-label"},m)):s?l().createElement("div",{className:"form-group has-error"},l().createElement("label",{className:"control-label"},m)):l().createElement("div",{className:"col-sm-12 ".concat(n||"has-error")},l().createElement("label",{className:"control-label"},l().createElement("i",{className:"fa ".concat(r||"fa-exclamation-circle")})," ",m)):null};i.propTypes={type:s().node,error:s().node,textClassName:s().string,iconClassName:s().string,margin:s().bool,errors:s().arrayOf(s().node)};const m=l().memo(i)}}]);
//# sourceMappingURL=9420.6bade54ff4b6c1e4f7cb.js.map