/*
 * @description:视图层login models
 * @Author: CP
 * @Date: 2020-09-01 17:43:05
 * @FilePath: \construction_management\web\viewmodels\login.go
 */
package viewmodels

import validation "github.com/go-ozzo/ozzo-validation/v3"

type Login struct {
	// Code     string `form:"code" json:"code"`
	Account  string `form:"account" json:"account"`
	Password string `form:"password" json:"password"`
	// Csrf     string `form:"csrf" json:"csrf"`
}

func (l Login) Validate() error {
	return validation.ValidateStruct(&l, validation.Field(&l.Account, validation.Required.Error("账号不能为空"), validation.Length(2, 50).Error("账号最少要输入 3 个字符")),
		validation.Field(&l.Password, validation.Required.Error("密码不能为空"), validation.Length(2, 50).Error("密码最少要输入 6 个字符"))) // Code cannot be empty, and the length must between 5 and 50
	// validation.Field(&l.Code, validation.Required.Error("项目编号不能为空"), validation.Length(3, 50).Error("项目编号最少要输入 3 个字符")),

}
