package com.mortals.xhx.base.login.web;

import com.mortals.framework.exception.AppException;
import com.mortals.framework.web.BaseForm;
import lombok.Data;


@Data
public class LoginForm {
    private String loginName;

    private String password;

    private String securityCode;

    @Override
    public String toString() {
        return "loginName:" + this.loginName + "  password:" + this.password + "  securityCode:" + this.securityCode;
    }

    public boolean validate() throws AppException {
        if (loginName == null || loginName.trim().length() == 0) {
            throw new AppException("帐号不能为空！");
        }
        if (password == null || password.trim().length() == 0) {
            throw new AppException("密码不能为空！");
        }
        if (securityCode == null || securityCode.trim().length() == 0) {
            throw new AppException("验证码不能为空！");
        }
        return true;
    }
}
