diff --git a/static/ui.js b/static/ui.js index 57606b5..173be08 100644 --- a/static/ui.js +++ b/static/ui.js @@ -4,6 +4,7 @@ var TabbedArea = ReactBootstrap.TabbedArea; var TabPane = ReactBootstrap.TabPane; var Panel = ReactBootstrap.Panel; var ButtonGroup = ReactBootstrap.ButtonGroup; +var Modal = ReactBootstrap.Modal; const NewUserForm = React.createClass({ getInitialState: function() { @@ -146,17 +147,25 @@ const NewUserForm = React.createClass({ } }); -const AccountSettings = React.createClass({ - getInitialState: function() { +const AccountSettingsModal = React.createClass({ + _getInitialState: function(props) { return {error: "", - name: this.props.user.Name, - username: this.props.user.Username, - email: this.props.user.Email, + name: props.user.Name, + username: props.user.Username, + email: props.user.Email, password: BogusPassword, confirm_password: BogusPassword, passwordChanged: false, initial_password: BogusPassword}; }, + getInitialState: function() { + return this._getInitialState(this.props); + }, + componentWillReceiveProps: function(nextProps) { + if (nextProps.show && !this.props.show) { + this.setState(this._getInitialState(nextProps)); + } + }, passwordValidationState: function() { if (this.state.passwordChanged) { if (this.state.password.length >= 10) @@ -224,7 +233,7 @@ const AccountSettings = React.createClass({ this.setState({error: e}); } else { user.Password = ""; - this.props.onSettingsSubmitted(user); + this.props.onSubmit(user); } }.bind(this), error: function(jqXHR, status, error) { @@ -236,9 +245,12 @@ const AccountSettings = React.createClass({ }); }, render: function() { - var title =