summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-07-10 01:54:25 -0700
committerCarlos Tadeu Panato Junior <ctadeu@gmail.com>2018-07-10 10:54:25 +0200
commit74e5d8ae66186a82e8afdd845a108d6a662751d7 (patch)
treefaeeee70a251b636bae0afb4e60c611e00c2cc6b /cmd
parent951e4ad98401e9828b9941224318f105fb15d500 (diff)
downloadchat-74e5d8ae66186a82e8afdd845a108d6a662751d7.tar.gz
chat-74e5d8ae66186a82e8afdd845a108d6a662751d7.tar.bz2
chat-74e5d8ae66186a82e8afdd845a108d6a662751d7.zip
MM-11120 Adding setting to disable email invitations and rate limiting. (#9063)
* Adding setting to disable email invitations. * Adding a setting and rate limiting for email invite sending. * Modifying email rate limit to 20/user/hour * Adding EnableEmailInvitations to client side config and command.
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mattermost/commands/user.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd/mattermost/commands/user.go b/cmd/mattermost/commands/user.go
index 373fe7463..b3b43c076 100644
--- a/cmd/mattermost/commands/user.go
+++ b/cmd/mattermost/commands/user.go
@@ -384,7 +384,11 @@ func inviteUser(a *app.App, email string, team *model.Team, teamArg string) erro
return fmt.Errorf("Can't find team '%v'", teamArg)
}
- a.SendInviteEmails(team, "Administrator", invites, *a.Config().ServiceSettings.SiteURL)
+ if !*a.Config().ServiceSettings.EnableEmailInvitations {
+ return fmt.Errorf("Email invites are disabled.")
+ }
+
+ a.SendInviteEmails(team, "Administrator", "Mattermost CLI "+model.NewId(), invites, *a.Config().ServiceSettings.SiteURL)
CommandPrettyPrintln("Invites may or may not have been sent.")
return nil