text: webpackJsonp([29],{1719:function(e,t,a){"use strict";(function(e){function r(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t.default=e,t}function s(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=a(6),l=s(o),n=a(2),u=s(n),i=a(5),c=s(i),d=a(4),f=s(d),m=a(3),p=s(m),g=a(46),h=a(15),v=s(h),M=a(11),E=r(M),b=a(1),y=s(b),_=a(13),S=a(37),N=function(t){function a(e){(0,u.default)(this,a);var t=(0,f.default)(this,(a.__proto__||(0,l.default)(a)).call(this,e));return t.submit=t.submit.bind(t),t.state={secret:"",qrCode:""},t}return(0,p.default)(a,t),(0,c.default)(a,[{key:"componentDidMount",value:function(){var e=this,t=v.default.getCurrentUser();if(!t||t.mfa_active)return void S.browserHistory.push("/");(0,g.generateMfaSecret)(function(t){return e.setState({secret:t.secret,qrCode:t.qr_code})},function(t){return e.setState({serverError:t.message})})}},{key:"submit",value:function(e){var t=this;e.preventDefault();var a=this.refs.code.value.replace(/\s/g,"");if(!a||0===a.length)return void this.setState({error:E.localizeMessage("mfa.setup.codeError","Please enter the code from Google Authenticator.")});this.setState({error:null}),(0,g.activateMfa)(a,function(){S.browserHistory.push("/mfa/confirm")},function(e){if("ent.mfa.activate.authenticate.app_error"===e.id)return void t.setState({error:E.localizeMessage("mfa.setup.badCode","Invalid code. If this issue persists, contact your System Administrator.")});t.setState({error:e.message})})}},{key:"render",value:function(){var t="form-group",a=void 0;this.state.error&&(a=y.default.createElement("div",{className:"form-group has-error"},y.default.createElement("label",{className:"control-label"},this.state.error)),t+=" has-error");var r=void 0;return"true"===e.window.mm_config.EnforceMultifactorAuthentication&&(r=y.default.createElement("p",null,y.default.createElement(_.FormattedHTMLMessage,{id:"mfa.setup.required",defaultMessage:"<strong>Multi-factor authentication is required on {siteName}.</strong>",values:{siteName:e.window.mm_config.SiteName}}))),y.default.createElement("div",null,y.default.createElement("form",{onSubmit:this.submit,className:t},r,y.default.createElement("p",null,y.default.createElement(_.FormattedHTMLMessage,{id:"mfa.setup.step1",defaultMessage:"<strong>Step 1: </strong>On your phone, download Google Authenticator from <a target='_blank' href='https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8'>iTunes</a> or <a target='_blank' href='https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en'>Google Play</a>"})),y.default.createElement("p",null,y.default.createElement(_.FormattedHTMLMessage,{id:"mfa.setup.step2",defaultMessage:"<strong>Step 2: </strong>Use Google Authenticator to scan this QR code, or manually type in the secret key"})),y.default.createElement("div",{className:"form-group"},y.default.createElement("div",{className:"col-sm-12"},y.default.createElement("img",{style:{maxHeight:170},src:"data:image/png;base64,"+this.state.qrCode}))),y.default.createElement("br",null),y.default.createElement("div",{className:"form-group"},y.default.createElement("p",{className:"col-sm-12"},y.default.createElement(_.FormattedMessage,{id:"mfa.setup.secret",defaultMessage:"Secret: {secret}",values:{secret:this.state.secret}}))),y.default.createElement("p",null,y.default.createElement(_.FormattedHTMLMessage,{id:"mfa.setup.step3",defaultMessage:"<strong>Step 3: </strong>Enter the code generated by Google Authenticator"})),y.default.createElement("p",null,y.default.createElement("input",{ref:"code",className:"form-control",placeholder:E.localizeMessage("mfa.setup.code","MFA Code"),autoFocus:!0})),a,y.default.createElement("button",{type:"submit",className:"btn btn-primary"},y.default.createElement(_.FormattedMessage,{id:"mfa.setup.save",defaultMessage:"Save"}))))}}]),a}(y.default.Component);t.default=N,N.defaultProps={},N.propTypes={}}).call(t,a(17))}});
  //# sourceMappingURL=29.df4b65be83babd7776f5.js.map