mirror of
https://github.com/miniflux/v2.git
synced 2025-08-01 17:38:37 +00:00
Refactor user validation
Validate each user field for creation/modification via API and web UI
This commit is contained in:
parent
291bf96d15
commit
e45cc2d2aa
40 changed files with 567 additions and 400 deletions
|
@ -4,8 +4,6 @@
|
|||
|
||||
package model // import "miniflux.app/model"
|
||||
|
||||
import "miniflux.app/errors"
|
||||
|
||||
// Themes returns the list of available themes.
|
||||
func Themes() map[string]string {
|
||||
return map[string]string{
|
||||
|
@ -29,14 +27,3 @@ func ThemeColor(theme string) string {
|
|||
return "#fff"
|
||||
}
|
||||
}
|
||||
|
||||
// ValidateTheme validates theme value.
|
||||
func ValidateTheme(theme string) error {
|
||||
for key := range Themes() {
|
||||
if key == theme {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
return errors.NewLocalizedError("Invalid theme")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue