webpackJsonp([36],{1844:function(e,t,a){"use strict";(function(e){function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var s=a(6),o=r(s),l=a(4),n=r(l),u=a(5),i=r(u),c=a(7),d=r(c),f=a(8),m=r(f),p=a(66),g=a(24),h=r(g),v=a(16),M=function(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}(v),E=a(1),b=r(E),y=a(18),_=a(44),S=function(t){function a(e){(0,n.default)(this,a);var t=(0,d.default)(this,(a.__proto__||(0,o.default)(a)).call(this,e));return t.submit=t.submit.bind(t),t.state={secret:"",qrCode:""},t}return(0,m.default)(a,t),(0,i.default)(a,[{key:"componentDidMount",value:function(){var e=this,t=h.default.getCurrentUser();if(!t||t.mfa_active)return void _.browserHistory.push("/");(0,p.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:M.localizeMessage("mfa.setup.codeError","Please enter the code from Google Authenticator.")});this.setState({error:null}),(0,p.activateMfa)(a,function(){_.browserHistory.push("/mfa/confirm")},function(e){if("ent.mfa.activate.authenticate.app_error"===e.id)return void t.setState({error:M.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=b.default.createElement("div",{className:"form-group has-error"},b.default.createElement("label",{className:"control-label"},this.state.error)),t+=" has-error");var r=void 0;return"true"===e.window.mm_config.EnforceMultifactorAuthentication&&(r=b.default.createElement("p",null,b.default.createElement(y.FormattedHTMLMessage,{id:"mfa.setup.required",defaultMessage:"<strong>Multi-factor authentication is required on {siteName}.</strong>",values:{siteName:e.window.mm_config.SiteName}}))),b.default.createElement("div",null,b.default.createElement("form",{onSubmit:this.submit,className:t},r,b.default.createElement("p",null,b.default.createElement(y.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>"})),b.default.createElement("p",null,b.default.createElement(y.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"})),b.default.createElement("div",{className:"form-group"},b.default.createElement("div",{className:"col-sm-12"},b.default.createElement("img",{style:{maxHeight:170},src:"data:image/png;base64,"+this.state.qrCode}))),b.default.createElement("br",null),b.default.createElement("div",{className:"form-group"},b.default.createElement("p",{className:"col-sm-12"},b.default.createElement(y.FormattedMessage,{id:"mfa.setup.secret",defaultMessage:"Secret: {secret}",values:{secret:this.state.secret}}))),b.default.createElement("p",null,b.default.createElement(y.FormattedHTMLMessage,{id:"mfa.setup.step3",defaultMessage:"<strong>Step 3: </strong>Enter the code generated by Google Authenticator"})),b.default.createElement("p",null,b.default.createElement("input",{ref:"code",className:"form-control",placeholder:M.localizeMessage("mfa.setup.code","MFA Code"),autoFocus:!0})),a,b.default.createElement("button",{type:"submit",className:"btn btn-primary"},b.default.createElement(y.FormattedMessage,{id:"mfa.setup.save",defaultMessage:"Save"}))))}}]),a}(b.default.Component);t.default=S,S.defaultProps={},S.propTypes={}}).call(t,a(22))}});
//# sourceMappingURL=36.14c12fe5a4496616747e.js.map