From d91fea65188a51dd41976cad47f9c8ebacd75a04 Mon Sep 17 00:00:00 2001 From: Ruzette Tanyag Date: Tue, 7 Feb 2017 11:54:07 -0500 Subject: Implement GET `/users/email/{email}` endpoint for APIv4 (#5309) * added get user by email endpoint for APIv4 * added get user by email endpoint unit test and driver * removed the appended return of user ids on logout * Added RequireEmail to validate user email. Also updated the get user by email endpoint and unit test --- api4/context.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'api4/context.go') diff --git a/api4/context.go b/api4/context.go index 1a3011795..7ad6f30b4 100644 --- a/api4/context.go +++ b/api4/context.go @@ -358,3 +358,16 @@ func (c *Context) RequireChannelId() *Context { } return c } + +func (c *Context) RequireEmail() *Context { + if c.Err != nil { + return c + } + + pos := strings.Index(c.Params.Email, "@") + if pos < 0 { + c.SetInvalidUrlParam("email") + } + + return c +} -- cgit v1.2.3-1-g7c22