photoprism/internal/form/login.go
Michael Mayer 1f1f92408a Sharing: Token authentication #18
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-06-25 01:20:58 +02:00

24 lines
493 B
Go

package form
type Login struct {
Email string `json:"email"`
UserName string `json:"username"`
Password string `json:"password"`
Token string `json:"token"`
}
func (f Login) HasToken() bool {
return f.Token != ""
}
func (f Login) HasUserName() bool {
return f.UserName != "" && len(f.UserName) <= 255
}
func (f Login) HasPassword() bool {
return f.Password != "" && len(f.Password) <= 255
}
func (f Login) HasCredentials() bool {
return f.HasUserName() && f.HasPassword()
}