diff options
author | Corey Hulen <corey@hulen.com> | 2015-08-27 15:59:16 -0700 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2015-08-27 15:59:16 -0700 |
commit | 8229acff35545238ddb7d4aebf5a57e2315979c4 (patch) | |
tree | 90c8d14fd8f21ebdf4fe0fffaa698b0f177abaf3 /web | |
parent | 088065206b7f401d049cdd4b7a8113ad29b5c5b9 (diff) | |
parent | 86a7743205c7c8ce839a042bb7bc7c4132bcfcc6 (diff) | |
download | chat-8229acff35545238ddb7d4aebf5a57e2315979c4.tar.gz chat-8229acff35545238ddb7d4aebf5a57e2315979c4.tar.bz2 chat-8229acff35545238ddb7d4aebf5a57e2315979c4.zip |
Merge pull request #504 from mattermost/MM-1032
MM-1032 auto-login after tream creation
Diffstat (limited to 'web')
-rw-r--r-- | web/react/components/team_signup_password_page.jsx | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/web/react/components/team_signup_password_page.jsx b/web/react/components/team_signup_password_page.jsx index e4f35f100..bbe82a5c2 100644 --- a/web/react/components/team_signup_password_page.jsx +++ b/web/react/components/team_signup_password_page.jsx @@ -31,31 +31,35 @@ module.exports = React.createClass({ teamSignup.user.allow_marketing = true; delete teamSignup.wizard; - // var ctl = this; - client.createTeamFromSignup(teamSignup, function success() { client.track('signup', 'signup_team_08_complete'); var props = this.props; - $('#sign-up-button').button('reset'); - props.state.wizard = 'finished'; - props.updateParent(props.state, true); + + client.loginByEmail(teamSignup.team.name, teamSignup.team.email, teamSignup.user.password, + function(data) { + UserStore.setLastEmail(teamSignup.team.email); + UserStore.setCurrentUser(teamSignup.user); + if (this.props.hash > 0) { + BrowserStore.setGlobalItem(this.props.hash, JSON.stringify({wizard: 'finished'})); + } - window.location.href = utils.getWindowLocationOrigin() + '/' + props.state.team.name + '/login?email=' + encodeURIComponent(teamSignup.team.email); + $('#sign-up-button').button('reset'); + props.state.wizard = 'finished'; + props.updateParent(props.state, true); - // client.loginByEmail(teamSignup.team.domain, teamSignup.team.email, teamSignup.user.password, - // function(data) { - // TeamStore.setLastName(teamSignup.team.domain); - // UserStore.setLastEmail(teamSignup.team.email); - // UserStore.setCurrentUser(data); - // window.location.href = '/channels/town-square'; - // }.bind(ctl), - // function(err) { - // this.setState({nameError: err.message}); - // }.bind(ctl) - // ); + window.location.href = '/'; + }.bind(this), + function(err) { + if (err.message === 'Login failed because email address has not been verified') { + window.location.href = '/verify_email?email=' + encodeURIComponent(teamSignup.team.email) + '&teamname=' + encodeURIComponent(teamSignup.team.name); + } else { + this.setState({serverError: err.message}); + } + }.bind(this) + ); }.bind(this), function error(err) { this.setState({serverError: err.message}); |