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

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

public class LoginForm extends BaseForm {
    private String loginName;

    private String password;

    private String securityCode;

    private String code;


    public String getLoginName() {
        return loginName;
    }

    public void setLoginName(String loginName) {
        this.loginName = loginName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    public String getSecurityCode() {
        return securityCode;
    }

    public void setSecurityCode(String securityCode) {
        this.securityCode = securityCode;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

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

    @Override
    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 super.validate();
    }
}
