"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),l=a(32446),s=a(88563),n=(a(5673),a(30164),a(21279),a(36418)),o=a.n(n),c=a(14778),i=a(85990),m=a(83984),p=a(83007);class d extends o().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,p.J)().replace("/error")};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,l.zH)({getOAuthAppInfo:s.LB,allowOAuth2:s.hg},e)}}))(d)},85990:(e,t,a)=>{a.d(t,{Ay:()=>c,Nq:()=>s});var r=a(36418),l=a.n(r);const s="backstage",n=[],o=e=>{let{error:t=null,errors:a=n,iconClassName:r,margin:o,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?l().createElement("div",{className:"form-group"},l().createElement("label",{className:"col-sm-12 has-error"},m)):i===s?l().createElement("div",{className:"pull-left has-error"},l().createElement("label",{className:"control-label"},m)):o?l().createElement("div",{className:"form-group has-error"},l().createElement("label",{className:"control-label"},m)):l().createElement("div",{className:`col-sm-12 ${c||"has-error"}`},l().createElement("label",{className:"control-label"},l().createElement("i",{className:`fa ${r||"fa-exclamation-circle"}`})," ",m)):null},c=l().memo(o)}}]);
//# sourceMappingURL=9420.61cd3282642be8532844.js.map