diff options
author | Christopher Speller <crspeller@gmail.com> | 2015-10-08 10:00:31 -0400 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2015-10-08 10:00:31 -0400 |
commit | 7a601afc64c20ce566efc59ed9f42f89fac3d26b (patch) | |
tree | e7858e8161014d860735c954a173b8d4850179f8 | |
parent | a6629f95fe958d2a308e62b5f662f9eca7aea0b2 (diff) | |
parent | 81b7f649ed44875aaf08d7121ba12ee9e89e798f (diff) | |
download | chat-7a601afc64c20ce566efc59ed9f42f89fac3d26b.tar.gz chat-7a601afc64c20ce566efc59ed9f42f89fac3d26b.tar.bz2 chat-7a601afc64c20ce566efc59ed9f42f89fac3d26b.zip |
Merge pull request #966 from mattermost/GIT-960
GIT-960 show error when you cannot create a team
-rw-r--r-- | api/team.go | 2 | ||||
-rw-r--r-- | web/react/components/team_signup_with_email.jsx | 18 | ||||
-rw-r--r-- | web/react/components/team_signup_with_sso.jsx | 8 |
3 files changed, 17 insertions, 11 deletions
diff --git a/api/team.go b/api/team.go index bb60e0720..9021fefb9 100644 --- a/api/team.go +++ b/api/team.go @@ -248,7 +248,7 @@ func createTeam(c *Context, w http.ResponseWriter, r *http.Request) { func CreateTeam(c *Context, team *model.Team) *model.Team { if !utils.Cfg.EmailSettings.EnableSignUpWithEmail { c.Err = model.NewAppError("createTeam", "Team sign-up with email is disabled.", "") - c.Err.StatusCode = http.StatusNotImplemented + c.Err.StatusCode = http.StatusForbidden return nil } diff --git a/web/react/components/team_signup_with_email.jsx b/web/react/components/team_signup_with_email.jsx index f27def191..015969dce 100644 --- a/web/react/components/team_signup_with_email.jsx +++ b/web/react/components/team_signup_with_email.jsx @@ -14,8 +14,8 @@ export default class EmailSignUpPage extends React.Component { } handleSubmit(e) { e.preventDefault(); - let team = {}; - let state = {serverError: ''}; + var team = {}; + var state = {serverError: ''}; team.email = React.findDOMNode(this.refs.email).value.trim().toLowerCase(); if (!team.email || !Utils.isEmail(team.email)) { @@ -31,20 +31,25 @@ export default class EmailSignUpPage extends React.Component { } Client.signupTeam(team.email, - function success(data) { + (data) => { if (data.follow_link) { window.location.href = data.follow_link; } else { window.location.href = `/signup_team_confirm/?email=${encodeURIComponent(team.email)}`; } }, - function fail(err) { + (err) => { state.serverError = err.message; this.setState(state); - }.bind(this) + } ); } render() { + var serverError = null; + if (this.state.serverError) { + serverError = <div className='form-group has-error'><label className='control-label'>{this.state.serverError}</label></div>; + } + return ( <form role='form' @@ -65,8 +70,9 @@ export default class EmailSignUpPage extends React.Component { className='btn btn-md btn-primary' type='submit' > - Sign up + {'Sign up'} </button> + {serverError} </div> <div className='form-group margin--extra-2x'> <span><a href='/find_team'>{`Find my teams`}</a></span> diff --git a/web/react/components/team_signup_with_sso.jsx b/web/react/components/team_signup_with_sso.jsx index 5267f44b6..bc7e13738 100644 --- a/web/react/components/team_signup_with_sso.jsx +++ b/web/react/components/team_signup_with_sso.jsx @@ -40,17 +40,17 @@ export default class SSOSignUpPage extends React.Component { client.createTeamWithSSO(team, this.props.service, - function success(data) { + (data) => { if (data.follow_link) { window.location.href = data.follow_link; } else { window.location.href = '/' + team.name + '/channels/town-square'; } }, - function fail(err) { + (err) => { state.serverError = err.message; this.setState(state); - }.bind(this) + } ); } nameChange() { @@ -85,7 +85,7 @@ export default class SSOSignUpPage extends React.Component { disabled={disabled} > <span className='icon'/> - <span>Create team with GitLab Account</span> + <span>{'Create team with GitLab Account'}</span> </a> ); } |