2019-12-05 19:21:35 +01:00
|
|
|
package form
|
|
|
|
|
|
|
|
type Login struct {
|
2019-12-11 14:10:20 +01:00
|
|
|
Email string `json:"email"`
|
2020-06-25 01:20:58 +02:00
|
|
|
UserName string `json:"username"`
|
2019-12-05 19:21:35 +01:00
|
|
|
Password string `json:"password"`
|
2020-06-25 01:20:58 +02:00
|
|
|
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()
|
2019-12-05 19:21:35 +01:00
|
|
|
}
|