"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9420],{9420:(e,t,a)=>{a.r(t),a.d(t,{default:()=>u});var r=a(37270),s=a(32446),l=a(88563),o=(a(5673),a(30164),a(21279),a(36418)),n=a.n(o),c=a(14778),i=a(14891),m=a(85990),p=a(83984),d=a(83007);class h extends n().PureComponent{constructor(e){super(e),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})}))}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("scope"),resource:e.get("resource"),codeChallenge:e.get("code_challenge"),codeChallengeMethod:e.get("code_challenge_method")};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})}))};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,d.J)().replace("/error")};render(){const e=this.state.app;if(!e)return null;let t,a;return t=e.icon_url?e.icon_url:p,this.state.error&&(a=n().createElement("div",{className:"prompt__error form-group"},n().createElement(m.Ay,{error:this.state.error}))),n().createElement("div",{className:"container-fluid"},n().createElement("div",{className:"prompt"},n().createElement("div",{className:"prompt__heading"},n().createElement("div",{className:"prompt__app-icon"},n().createElement("img",{alt:"prompt icon",src:t,width:"50",height:"50"})),n().createElement("div",{className:"text"},n().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=>n().createElement("b",null,e)}}))),n().createElement("p",null,n().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=>n().createElement("b",null,e)}})),n().createElement("h2",{className:"prompt__allow"},n().createElement(c.FormattedMessage,{id:"authorize.allowAccess",defaultMessage:"Allow <b>{appName}</b> access?",values:{appName:e.name,b:e=>n().createElement("b",null,e)}})),n().createElement("div",{className:"prompt__buttons"},n().createElement(i.Button,{type:"submit",emphasis:"tertiary",className:"authorize-btn",onClick:this.handleDeny},n().createElement(c.FormattedMessage,{id:"authorize.deny",defaultMessage:"Deny"})),n().createElement(i.Button,{type:"submit",emphasis:"primary",className:"authorize-btn",onClick:this.handleAllow},n().createElement(c.FormattedMessage,{id:"authorize.allow",defaultMessage:"Allow"}))),a))}}const u=(0,r.connect)(null,(function(e){return{actions:(0,s.zH)({getOAuthAppInfo:l.LB,allowOAuth2:l.hg},e)}}))(h)},85990:(e,t,a)=>{a.d(t,{Ay:()=>c,Nq:()=>l});var r=a(36418),s=a.n(r);const l="backstage",o=[],n=e=>{let{error:t=null,errors:a=o,iconClassName:r,margin:n,textClassName:c,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?s().createElement("div",{className:"form-group"},s().createElement("label",{className:"col-sm-12 has-error"},m)):i===l?s().createElement("div",{className:"pull-left has-error"},s().createElement("label",{className:"control-label"},m)):n?s().createElement("div",{className:"form-group has-error"},s().createElement("label",{className:"control-label"},m)):s().createElement("div",{className:`col-sm-12 ${c||"has-error"}`},s().createElement("label",{className:"control-label"},s().createElement("i",{className:`fa ${r||"fa-exclamation-circle"}`})," ",m)):null},c=s().memo(n)}}]);
//# sourceMappingURL=9420.75e91762b8b4869e07f8.js.map