Merge pull request #149 from rgarmsen2295/mm-1260

MM-1260 Member Invites can no longer be sent to emails already used to signup
Этот коммит содержится в:
Christopher Speller
2015-07-08 20:24:39 -04:00
родитель 11dde6c44b 65dc307e68
Коммит 3ad2098926
2 изменённых файлов: 15 добавлений и 1 удалений

Просмотреть файл

@@ -456,6 +456,15 @@ func inviteMembers(c *Context, w http.ResponseWriter, r *http.Request) {
user = result.Data.(*model.User)
}
var invNum int64 = 0
for i, invite := range invites.Invites {
if result := <-Srv.Store.User().GetByEmail(c.Session.TeamId, invite["email"]); result.Err == nil || result.Err.Message != "We couldn't find the existing account" {
invNum = int64(i)
c.Err = model.NewAppError("invite_members", "This person is already on your team", strconv.FormatInt(invNum, 10))
return
}
}
ia := make([]string, len(invites.Invites))
for _, invite := range invites.Invites {
ia = append(ia, invite["email"])