1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-07-02 16:38:37 +00:00

Make sure people don't create duplicate Fever usernames

This commit is contained in:
Frédéric Guillot 2017-12-29 14:38:43 -08:00
parent 9eb91e6f0b
commit 038ea790f7
4 changed files with 27 additions and 5 deletions

View file

@ -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 {