1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-01 17:38:37 +00:00

Add per-application API Keys

This commit is contained in:
Frédéric Guillot 2020-03-01 17:38:29 -08:00
parent d1afe13a1c
commit 25cc0d2447
35 changed files with 940 additions and 71 deletions

32
ui/form/api_key.go Normal file
View file

@ -0,0 +1,32 @@
// Copyright 2020 Frédéric Guillot. All rights reserved.
// Use of this source code is governed by the Apache 2.0
// license that can be found in the LICENSE file.
package form // import "miniflux.app/ui/form"
import (
"net/http"
"miniflux.app/errors"
)
// APIKeyForm represents the API Key form.
type APIKeyForm struct {
Description string
}
// Validate makes sure the form values are valid.
func (a APIKeyForm) Validate() error {
if a.Description == "" {
return errors.NewLocalizedError("error.fields_mandatory")
}
return nil
}
// NewAPIKeyForm returns a new APIKeyForm.
func NewAPIKeyForm(r *http.Request) *APIKeyForm {
return &APIKeyForm{
Description: r.FormValue("description"),
}
}