[MM-23721] api4/user: add verify user by Id endpoint (#14244)

* api4/user: add verify user by id method

* Update api4/user.go

Co-Authored-By: Miguel de la Cruz <miguel@mcrx.me>

* Update model/client4.go

Co-Authored-By: Miguel de la Cruz <miguel@mcrx.me>

* api4/user: reflect review comments

* Update api4/user_test.go

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>

Co-authored-by: Miguel de la Cruz <miguel@mcrx.me>
Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2020-06-26 16:08:01 +03:00
коммит произвёл GitHub
родитель d0e035467c
Коммит f7f1f0d268
3 изменённых файлов: 73 добавлений и 0 удалений

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

@@ -1325,6 +1325,16 @@ func (c *Client4) VerifyUserEmail(token string) (bool, *Response) {
return CheckStatusOK(r), BuildResponse(r)
}
// VerifyUserEmailWithoutToken will verify a user's email by its Id. (Requires manage system role)
func (c *Client4) VerifyUserEmailWithoutToken(userId string) (*User, *Response) {
r, err := c.DoApiPost(c.GetUserRoute(userId)+"/email/verify/member", "")
if err != nil {
return nil, BuildErrorResponse(r, err)
}
defer closeBody(r)
return UserFromJson(r.Body), BuildResponse(r)
}
// SendVerificationEmail will send an email to the user with the provided email address, if
// that user exists. The email will contain a link that can be used to verify the user's
// email address.