fix: register request validation
This commit is contained in:
parent
c0df04d7d5
commit
c197b1425b
|
@ -7,9 +7,10 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type RegisterRequest struct {
|
type RegisterRequest struct {
|
||||||
Email string `json:"email"`
|
validatable validators.ValidatableImpl
|
||||||
Password string `json:"password"`
|
Email string `json:"email"`
|
||||||
Pubkey string `json:"pubkey"`
|
Password string `json:"password"`
|
||||||
|
Pubkey string `json:"pubkey"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r RegisterRequest) Validate() error {
|
func (r RegisterRequest) Validate() error {
|
||||||
|
@ -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