summaryrefslogtreecommitdiffstats
path: root/api/team.go
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2017-01-04 14:11:48 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-04 14:11:47 -0500
commit635628cf30460a75d3a870394ad66db91f3bea9f (patch)
tree17d40987fab0876c6dc95acec7f82b4f3eb36c01 /api/team.go
parentb3f2ab654e95325b556e0c93b41ea6e15e45fffe (diff)
downloadchat-635628cf30460a75d3a870394ad66db91f3bea9f.tar.gz
chat-635628cf30460a75d3a870394ad66db91f3bea9f.tar.bz2
chat-635628cf30460a75d3a870394ad66db91f3bea9f.zip
Removing old signup team API (#4950)
Diffstat (limited to 'api/team.go')
-rw-r--r--api/team.go52
1 files changed, 0 insertions, 52 deletions
diff --git a/api/team.go b/api/team.go
index be64403a2..c17bf87af 100644
--- a/api/team.go
+++ b/api/team.go
@@ -25,7 +25,6 @@ func InitTeam() {
l4g.Debug(utils.T("api.team.init.debug"))
BaseRoutes.Teams.Handle("/create", ApiAppHandler(createTeam)).Methods("POST")
- BaseRoutes.Teams.Handle("/signup", ApiAppHandler(signupTeam)).Methods("POST")
BaseRoutes.Teams.Handle("/all", ApiAppHandler(getAll)).Methods("GET")
BaseRoutes.Teams.Handle("/all_team_listings", ApiUserRequired(GetAllTeamListings)).Methods("GET")
BaseRoutes.Teams.Handle("/get_invite_info", ApiAppHandler(getInviteInfo)).Methods("POST")
@@ -52,57 +51,6 @@ func InitTeam() {
BaseRoutes.Teams.Handle("/add_user_to_team_from_invite", ApiUserRequired(addUserToTeamFromInvite)).Methods("POST")
}
-func signupTeam(c *Context, w http.ResponseWriter, r *http.Request) {
- if !utils.Cfg.EmailSettings.EnableSignUpWithEmail {
- c.Err = model.NewLocAppError("signupTeam", "api.team.signup_team.email_disabled.app_error", nil, "")
- c.Err.StatusCode = http.StatusNotImplemented
- return
- }
-
- m := model.MapFromJson(r.Body)
- email := strings.ToLower(strings.TrimSpace(m["email"]))
-
- if len(email) == 0 {
- c.SetInvalidParam("signupTeam", "email")
- return
- }
-
- if !isTeamCreationAllowed(c, email) {
- return
- }
-
- subject := c.T("api.templates.signup_team_subject",
- map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]})
-
- bodyPage := utils.NewHTMLTemplate("signup_team_body", c.Locale)
- bodyPage.Props["SiteURL"] = c.GetSiteURL()
- bodyPage.Props["Title"] = c.T("api.templates.signup_team_body.title")
- bodyPage.Props["Button"] = c.T("api.templates.signup_team_body.button")
- bodyPage.Html["Info"] = template.HTML(c.T("api.templates.signup_team_body.info",
- map[string]interface{}{"SiteName": utils.ClientCfg["SiteName"]}))
-
- props := make(map[string]string)
- props["email"] = email
- props["time"] = fmt.Sprintf("%v", model.GetMillis())
-
- data := model.MapToJson(props)
- hash := model.HashPassword(fmt.Sprintf("%v:%v", data, utils.Cfg.EmailSettings.InviteSalt))
-
- bodyPage.Props["Link"] = fmt.Sprintf("%s/signup_team_complete/?d=%s&h=%s", c.GetSiteURL(), url.QueryEscape(data), url.QueryEscape(hash))
-
- if err := utils.SendMail(email, subject, bodyPage.Render()); err != nil {
- c.Err = err
- return
- }
-
- if !utils.Cfg.EmailSettings.RequireEmailVerification {
- m["follow_link"] = fmt.Sprintf("/signup_team_complete/?d=%s&h=%s", url.QueryEscape(data), url.QueryEscape(hash))
- }
-
- w.Header().Set("Access-Control-Allow-Origin", " *")
- w.Write([]byte(model.MapToJson(m)))
-}
-
func createTeam(c *Context, w http.ResponseWriter, r *http.Request) {
team := model.TeamFromJson(r.Body)