diff options
author | Jesús Espino <jespinog@gmail.com> | 2018-04-18 22:46:10 +0200 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2018-04-18 13:46:10 -0700 |
commit | 0910eae31de8ed7b409654515dbd11f5c86dbf71 (patch) | |
tree | 3d5fb47842693cd2ea1a357994c85d04902773a7 /api4/team.go | |
parent | b13a228b0451098ea32933a36fe64566e366583d (diff) | |
download | chat-0910eae31de8ed7b409654515dbd11f5c86dbf71.tar.gz chat-0910eae31de8ed7b409654515dbd11f5c86dbf71.tar.bz2 chat-0910eae31de8ed7b409654515dbd11f5c86dbf71.zip |
MM-9779: Incorporate a Token into the invitations system (#8604)
* Incorporate a Token into the invitations system
* Adding unit tests
* Fixing some api4 client tests
* Removing unnecesary hash validation
* Change the Hash concept on invitations with tokenId
* Not send invitation if it wasn't able to create the Token
* Fixing some naming problems
* Changing the hash query params received from the client side
* Removed unneded data param in the token usage
Diffstat (limited to 'api4/team.go')
-rw-r--r-- | api4/team.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/api4/team.go b/api4/team.go index 33cd57fbb..94035a770 100644 --- a/api4/team.go +++ b/api4/team.go @@ -376,15 +376,14 @@ func addTeamMember(c *Context, w http.ResponseWriter, r *http.Request) { } func addUserToTeamFromInvite(c *Context, w http.ResponseWriter, r *http.Request) { - hash := r.URL.Query().Get("hash") - data := r.URL.Query().Get("data") + tokenId := r.URL.Query().Get("token") inviteId := r.URL.Query().Get("invite_id") var member *model.TeamMember var err *model.AppError - if len(hash) > 0 && len(data) > 0 { - member, err = c.App.AddTeamMemberByHash(c.Session.UserId, hash, data) + if len(tokenId) > 0 { + member, err = c.App.AddTeamMemberByToken(c.Session.UserId, tokenId) } else if len(inviteId) > 0 { member, err = c.App.AddTeamMemberByInviteId(inviteId, c.Session.UserId) } else { |