From d2b556aa77cc8e8f7d7aef340950fb632fba2aa6 Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Tue, 17 May 2016 15:52:03 -0400 Subject: Removed check of email signup from creating a team (#3029) --- api/team.go | 5 ----- 1 file changed, 5 deletions(-) (limited to 'api') diff --git a/api/team.go b/api/team.go index 52d01b1cc..3ed9b70af 100644 --- a/api/team.go +++ b/api/team.go @@ -222,11 +222,6 @@ 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.NewLocAppError("createTeam", "api.team.create_team.email_disabled.app_error", nil, "") - c.Err.StatusCode = http.StatusForbidden - return nil - } if team == nil { c.SetInvalidParam("createTeam", "team") -- cgit v1.2.3-1-g7c22 From ac509b114df1c1b4b841eded74fb797805e0162d Mon Sep 17 00:00:00 2001 From: =Corey Hulen Date: Tue, 17 May 2016 13:55:51 -0700 Subject: Fixing websocket connection --- api/context.go | 2 +- api/web_conn.go | 12 ++++++------ api/web_socket.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'api') diff --git a/api/context.go b/api/context.go index 67b04c391..f87a306d9 100644 --- a/api/context.go +++ b/api/context.go @@ -568,7 +568,7 @@ func GetSession(token string) *model.Session { } else { session = sessionResult.Data.(*model.Session) - if session.IsExpired() { + if session.IsExpired() || session.Token != token { return nil } else { AddSessionToCache(session) diff --git a/api/web_conn.go b/api/web_conn.go index 21b6f5b91..9a6fc29df 100644 --- a/api/web_conn.go +++ b/api/web_conn.go @@ -22,19 +22,19 @@ const ( type WebConn struct { WebSocket *websocket.Conn Send chan *model.Message - SessionId string + SessionToken string UserId string hasPermissionsToChannel map[string]bool hasPermissionsToTeam map[string]bool } -func NewWebConn(ws *websocket.Conn, userId string, sessionId string) *WebConn { +func NewWebConn(ws *websocket.Conn, userId string, sessionToken string) *WebConn { go func() { - achan := Srv.Store.User().UpdateUserAndSessionActivity(userId, sessionId, model.GetMillis()) + achan := Srv.Store.User().UpdateUserAndSessionActivity(userId, sessionToken, model.GetMillis()) pchan := Srv.Store.User().UpdateLastPingAt(userId, model.GetMillis()) if result := <-achan; result.Err != nil { - l4g.Error(utils.T("api.web_conn.new_web_conn.last_activity.error"), userId, sessionId, result.Err) + l4g.Error(utils.T("api.web_conn.new_web_conn.last_activity.error"), userId, sessionToken, result.Err) } if result := <-pchan; result.Err != nil { @@ -46,7 +46,7 @@ func NewWebConn(ws *websocket.Conn, userId string, sessionId string) *WebConn { Send: make(chan *model.Message, 64), WebSocket: ws, UserId: userId, - SessionId: sessionId, + SessionToken: sessionToken, hasPermissionsToChannel: make(map[string]bool), hasPermissionsToTeam: make(map[string]bool), } @@ -125,7 +125,7 @@ func (c *WebConn) InvalidateCacheForChannel(channelId string) { func (c *WebConn) HasPermissionsToTeam(teamId string) bool { perm, ok := c.hasPermissionsToTeam[teamId] if !ok { - session := GetSession(c.SessionId) + session := GetSession(c.SessionToken) if session == nil { perm = false c.hasPermissionsToTeam[teamId] = perm diff --git a/api/web_socket.go b/api/web_socket.go index 72a9c61a6..4c4a56c52 100644 --- a/api/web_socket.go +++ b/api/web_socket.go @@ -33,7 +33,7 @@ func connect(c *Context, w http.ResponseWriter, r *http.Request) { return } - wc := NewWebConn(ws, c.Session.UserId, c.Session.Id) + wc := NewWebConn(ws, c.Session.UserId, c.Session.Token) hub.Register(wc) go wc.writePump() wc.readPump() -- cgit v1.2.3-1-g7c22