fix: register request validation
This commit is contained in:
parent
c0df04d7d5
commit
c197b1425b
|
@ -7,6 +7,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type RegisterRequest struct {
|
type RegisterRequest struct {
|
||||||
|
validatable validators.ValidatableImpl
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Pubkey string `json:"pubkey"`
|
Pubkey string `json:"pubkey"`
|
||||||
|
@ -19,3 +20,6 @@ func (r RegisterRequest) Validate() error {
|
||||||
validation.Field(&r.Password, validation.When(len(r.Pubkey) == 0, validation.Required)),
|
validation.Field(&r.Password, validation.When(len(r.Pubkey) == 0, validation.Required)),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
func (r RegisterRequest) Import(d map[string]interface{}) (validators.Validatable, error) {
|
||||||
|
return r.validatable.Import(d, r)
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue