From 81b7f649ed44875aaf08d7121ba12ee9e89e798f Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Wed, 7 Oct 2015 10:07:08 -0700 Subject: GIT-960 show error when you cannot create a team --- api/team.go | 2 +- web/react/components/team_signup_with_email.jsx | 18 ++++++++++++------ 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 8e5d634aa..152e3d6d7 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 4fb1c0d01..ba9d4c3e0 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 =
; + } + return (
- Sign up + {'Sign up'} + {serverError}
{`Find my team`} diff --git a/web/react/components/team_signup_with_sso.jsx b/web/react/components/team_signup_with_sso.jsx index 14f281f7a..0c064411a 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} > - Create team with GitLab Account + {'Create team with GitLab Account'} ); } -- cgit v1.2.3-1-g7c22