diff options
Diffstat (limited to 'model')
-rw-r--r-- | model/client.go | 20 | ||||
-rw-r--r-- | model/client4.go | 18 |
2 files changed, 19 insertions, 19 deletions
diff --git a/model/client.go b/model/client.go index b56043a92..b48d1ac37 100644 --- a/model/client.go +++ b/model/client.go @@ -377,11 +377,11 @@ func (c *Client) AddUserToTeam(teamId string, userId string) (*Result, *AppError } // AddUserToTeamFromInvite adds a user to a team based off data provided in an invite link. -// Either hash and dataToHash are required or inviteId is required. -func (c *Client) AddUserToTeamFromInvite(hash, dataToHash, inviteId string) (*Result, *AppError) { +// Either token and data are required or inviteId is required. +func (c *Client) AddUserToTeamFromInvite(token, inviteData, inviteId string) (*Result, *AppError) { data := make(map[string]string) - data["hash"] = hash - data["data"] = dataToHash + data["token"] = token + data["data"] = inviteData data["invite_id"] = inviteId if r, err := c.DoApiPost("/teams/add_user_to_team_from_invite", MapToJson(data)); err != nil { return nil, err @@ -438,7 +438,7 @@ func (c *Client) UpdateTeam(team *Team) (*Result, *AppError) { // User Routes Section // CreateUser creates a user in the system based on the provided user struct. -func (c *Client) CreateUser(user *User, hash string) (*Result, *AppError) { +func (c *Client) CreateUser(user *User, token string) (*Result, *AppError) { if r, err := c.DoApiPost("/users/create", user.ToJson()); err != nil { return nil, err } else { @@ -448,11 +448,11 @@ func (c *Client) CreateUser(user *User, hash string) (*Result, *AppError) { } } -// CreateUserWithInvite creates a user based on the provided user struct. Either the hash and +// CreateUserWithInvite creates a user based on the provided user struct. Either the token and // data strings or the inviteId is required from the invite. -func (c *Client) CreateUserWithInvite(user *User, hash string, data string, inviteId string) (*Result, *AppError) { +func (c *Client) CreateUserWithInvite(user *User, token string, data string, inviteId string) (*Result, *AppError) { - url := "/users/create?d=" + url.QueryEscape(data) + "&h=" + url.QueryEscape(hash) + "&iid=" + url.QueryEscape(inviteId) + url := "/users/create?d=" + url.QueryEscape(data) + "&t=" + url.QueryEscape(token) + "&iid=" + url.QueryEscape(inviteId) if r, err := c.DoApiPost(url, user.ToJson()); err != nil { return nil, err @@ -463,8 +463,8 @@ func (c *Client) CreateUserWithInvite(user *User, hash string, data string, invi } } -func (c *Client) CreateUserFromSignup(user *User, data string, hash string) (*Result, *AppError) { - if r, err := c.DoApiPost("/users/create?d="+url.QueryEscape(data)+"&h="+hash, user.ToJson()); err != nil { +func (c *Client) CreateUserFromSignup(user *User, data string, token string) (*Result, *AppError) { + if r, err := c.DoApiPost("/users/create?d="+url.QueryEscape(data)+"&t="+token, user.ToJson()); err != nil { return nil, err } else { defer closeBody(r) diff --git a/model/client4.go b/model/client4.go index f1feb1bfe..870e440e8 100644 --- a/model/client4.go +++ b/model/client4.go @@ -530,13 +530,13 @@ func (c *Client4) CreateUser(user *User) (*User, *Response) { } } -// CreateUserWithHash creates a user in the system based on the provided user struct and hash created. -func (c *Client4) CreateUserWithHash(user *User, hash, data string) (*User, *Response) { +// CreateUserWithToken creates a user in the system based on the provided tokenId. +func (c *Client4) CreateUserWithToken(user *User, tokenId string) (*User, *Response) { var query string - if hash != "" && data != "" { - query = fmt.Sprintf("?d=%v&h=%v", url.QueryEscape(data), hash) + if tokenId != "" { + query = fmt.Sprintf("?t=%v", tokenId) } else { - err := NewAppError("MissingHashOrData", "api.user.create_user.missing_hash_or_data.app_error", nil, "", http.StatusBadRequest) + err := NewAppError("MissingHashOrData", "api.user.create_user.missing_token.app_error", nil, "", http.StatusBadRequest) return nil, &Response{StatusCode: err.StatusCode, Error: err} } if r, err := c.DoApiPost(c.GetUsersRoute()+query, user.ToJson()); err != nil { @@ -1340,16 +1340,16 @@ func (c *Client4) AddTeamMember(teamId, userId string) (*TeamMember, *Response) } // AddTeamMemberFromInvite adds a user to a team and return a team member using an invite id -// or an invite hash/data pair. -func (c *Client4) AddTeamMemberFromInvite(hash, dataToHash, inviteId string) (*TeamMember, *Response) { +// or an invite token/data pair. +func (c *Client4) AddTeamMemberFromInvite(token, inviteId string) (*TeamMember, *Response) { var query string if inviteId != "" { query += fmt.Sprintf("?invite_id=%v", inviteId) } - if hash != "" && dataToHash != "" { - query += fmt.Sprintf("?hash=%v&data=%v", hash, dataToHash) + if token != "" { + query += fmt.Sprintf("?token=%v", token) } if r, err := c.DoApiPost(c.GetTeamsRoute()+"/members/invite"+query, ""); err != nil { |