webpackJsonp([20],{583:function(e,t,a){"use strict";function l(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var n=a(1),i=l(n),o=a(5),r=l(o),u=a(109),s=l(u),d=a(17),c=l(d),m=a(29),f=l(m),p=a(31),g=l(p);a(938);var h=function(e){var t=e.lastError;return null===t?null:i["default"].createElement(f["default"],{isError:!0,description:"Authentication failed: "+t})},E=function(e){var t=e.onSubmit,a=e.loading,l=e.allowLogin;return l?a?i["default"].createElement(g["default"],{size:"small",inline:!0,text:""}):i["default"].createElement("input",{className:"ui button fluid large submit",value:"Login",type:"submit",onClick:t}):null},v=function(){return null},w=13,N=i["default"].createClass({displayName:"Login",mixins:[r["default"].connect(c["default"],"login")],contextTypes:{router:i["default"].PropTypes.object},getInitialState:function(){return{loading:!1}},componentWillUpdate:function(e,t){if(t.login.socketAuthenticated){var a=this.props.location.state?this.props.location.state.nextPath:"/";this.context.router.replace({pathname:a})}else this.state.loading&&null!==t.login.lastError&&this.setState({loading:!1})},_onKeyDown:function(e){e.keyCode===w&&this.onSubmit(e)},onSubmit:function(e){var t=this.refs.username.value,a=this.refs.password.value;e.preventDefault(),""!==t&&""!==a&&(s["default"].login(t,a),this.setState({loading:!0}))},render:function(){return i["default"].createElement("div",{className:"ui middle aligned center aligned grid login-grid"},i["default"].createElement("div",{className:"column"},i["default"].createElement("form",{className:"ui large form",onKeyDown:this._onKeyDown,autoComplete:"on"},i["default"].createElement("div",{className:"ui stacked segment"},i["default"].createElement("div",{className:"field"},i["default"].createElement("div",{className:"ui left icon input"},i["default"].createElement("i",{className:"user icon"}),i["default"].createElement("input",{type:"text",name:"username",placeholder:"Username",ref:"username",autoFocus:!0}))),i["default"].createElement("div",{className:"field"},i["default"].createElement("div",{className:"ui left icon input"},i["default"].createElement("i",{className:"lock icon"}),i["default"].createElement("input",{className:"password",name:"password",placeholder:"Password",ref:"password",type:"password"}))),i["default"].createElement(E,{onSubmit:this.onSubmit,loading:this.state.loading,allowLogin:c["default"].allowLogin})),i["default"].createElement(v,null)),i["default"].createElement(h,{userLoggedIn:c["default"].isLoggedIn,lastError:c["default"].lastError})))}});t["default"]=N},709:function(e,t,a){t=e.exports=a(15)(),t.push([e.id,".login-grid{margin:0!important;height:100%}.login-grid .column{max-width:650px;width:95%!important}",""])},938:[964,709]});
//# sourceMappingURL=login.chunk.js.map