webpackJsonp([54],{2119: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 l=a(6),s=r(l),o=a(4),i=r(o),u=a(5),n=r(u),d=a(7),c=r(d),m=a(8),f=r(m),p=a(2),h=r(p),w=a(1),_=r(w),v=a(46),y=r(v),E=a(17),g=a(742),M=a(9),b=r(M),S=a(16),N=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}(S),P=function(t){function a(e){(0,i.default)(this,a);var t=(0,c.default)(this,(a.__proto__||(0,s.default)(a)).call(this,e));return t.submit=t.submit.bind(t),t.state={},t}return(0,f.default)(a,t),(0,n.default)(a,[{key:"submit",value:function(e){var t=this;e.preventDefault();var a={},r=y.default.findDOMNode(this.refs.password).value;if(!r)return a.error=N.localizeMessage("claim.oauth_to_email.enterPwd","Please enter a password."),void this.setState(a);var l=N.isValidPassword(r);if(""!==l)return void this.setState({error:l});var s=y.default.findDOMNode(this.refs.passwordconfirm).value;if(!s||r!==s)return a.error=N.localizeMessage("claim.oauth_to_email.pwdNotMatch","Password do not match."),void this.setState(a);a.error=null,this.setState(a),(0,g.oauthToEmail)(this.props.currentType,this.props.email,r,null,function(e){t.setState({error:e.message})})}},{key:"render",value:function(){var t=null;this.state.error&&(t=_.default.createElement("div",{className:"form-group has-error"},_.default.createElement("label",{className:"control-label"},this.state.error)));var a="form-group";t&&(a+=" has-error");var r=(this.props.currentType===b.default.SAML_SERVICE?b.default.SAML_SERVICE.toUpperCase():N.toTitleCase(this.props.currentType))+" SSO";return _.default.createElement("div",null,_.default.createElement("h3",null,_.default.createElement(E.FormattedMessage,{id:"claim.oauth_to_email.title",defaultMessage:"Switch {type} Account to Email",values:{type:r}})),_.default.createElement("form",{onSubmit:this.submit},_.default.createElement("p",null,_.default.createElement(E.FormattedMessage,{id:"claim.oauth_to_email.description",defaultMessage:"Upon changing your account type, you will only be able to login with your email and password."})),_.default.createElement("p",null,_.default.createElement(E.FormattedMessage,{id:"claim.oauth_to_email.enterNewPwd",defaultMessage:"Enter a new password for your {site} email account",values:{site:e.window.mm_config.SiteName}})),_.default.createElement("div",{className:a},_.default.createElement("input",{type:"password",className:"form-control",name:"password",ref:"password",placeholder:N.localizeMessage("claim.oauth_to_email.newPwd","New Password"),spellCheck:"false"})),_.default.createElement("div",{className:a},_.default.createElement("input",{type:"password",className:"form-control",name:"passwordconfirm",ref:"passwordconfirm",placeholder:N.localizeMessage("claim.oauth_to_email.confirm","Confirm Password"),spellCheck:"false"})),t,_.default.createElement("button",{type:"submit",className:"btn btn-primary"},_.default.createElement(E.FormattedMessage,{id:"claim.oauth_to_email.switchTo",defaultMessage:"Switch {type} to email and password",values:{type:r}}))))}}]),a}(_.default.Component);t.default=P,P.defaultProps={},P.propTypes={currentType:h.default.string,email:h.default.string}}).call(t,a(22))}});
//# sourceMappingURL=54.20730e6700024ac7d28f.js.map