summaryrefslogtreecommitdiffstats
path: root/api4/context.go
diff options
context:
space:
mode:
Diffstat (limited to 'api4/context.go')
-rw-r--r--api4/context.go13
1 files changed, 13 insertions, 0 deletions
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
+}