mirror of https://github.com/synctv-org/synctv
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
455 B
Go
24 lines
455 B
Go
2 years ago
|
package model
|
||
|
|
||
|
import (
|
||
|
"github.com/gin-gonic/gin"
|
||
|
json "github.com/json-iterator/go"
|
||
|
)
|
||
|
|
||
|
type SetUserPasswordReq struct {
|
||
|
Password string `json:"password"`
|
||
|
}
|
||
|
|
||
|
func (s *SetUserPasswordReq) Decode(ctx *gin.Context) error {
|
||
|
return json.NewDecoder(ctx.Request.Body).Decode(s)
|
||
|
}
|
||
|
|
||
|
func (s *SetUserPasswordReq) Validate() error {
|
||
|
if s.Password == "" {
|
||
|
return ErrEmptyPassword
|
||
|
} else if len(s.Password) > 32 {
|
||
|
return ErrPasswordTooLong
|
||
|
}
|
||
|
return nil
|
||
|
}
|