diff options
author | 2017-12-29 14:38:43 -0800 | |
---|---|---|
committer | 2017-12-29 14:38:43 -0800 | |
commit | 038ea790f76243b7e08119438bed24a37d452cb7 (patch) | |
tree | 0f6f089bd7f22e33b0ef18ab446256bee4bff309 /server/ui/controller/integrations.go | |
parent | 9eb91e6f0b175a1e96fd252924a52261ee595ba8 (diff) | |
download | v2-038ea790f76243b7e08119438bed24a37d452cb7.tar.gz v2-038ea790f76243b7e08119438bed24a37d452cb7.tar.zst v2-038ea790f76243b7e08119438bed24a37d452cb7.zip |
Make sure people don't create duplicate Fever usernames
Diffstat (limited to 'server/ui/controller/integrations.go')
-rw-r--r-- | server/ui/controller/integrations.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/server/ui/controller/integrations.go b/server/ui/controller/integrations.go index 99971b07..9ff4baa4 100644 --- a/server/ui/controller/integrations.go +++ b/server/ui/controller/integrations.go @@ -62,6 +62,12 @@ func (c *Controller) UpdateIntegration(ctx *core.Context, request *core.Request, integrationForm := form.NewIntegrationForm(request.Request()) integrationForm.Merge(integration) + if integration.FeverUsername != "" && c.store.HasDuplicateFeverUsername(user.ID, integration.FeverUsername) { + ctx.SetFlashErrorMessage(ctx.Translate("There is already someone else with the same Fever username!")) + response.Redirect(ctx.Route("integrations")) + return + } + if integration.FeverEnabled { integration.FeverToken = fmt.Sprintf("%x", md5.Sum([]byte(integration.FeverUsername+":"+integration.FeverPassword))) } else { |