package com.apobates.forum.thrones.admin.controller.form;

import com.apobates.forum.utils.Commons;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 登录表单[前端]
 * @author xiaofanku
 * @since 20200603
 */
public class LoginForm extends ActionForm{
    @NotBlank(message="{NotBlank.LoginForm.names}")
    @Size(min=5, max=20, message="{Size.LoginForm.names}")
    @Pattern(regexp = "^[A-Za-z0-9]+$", message="{Pattern.LoginForm.names}")
    private String names;
    @NotBlank(message="{NotBlank.LoginForm.pswd}")
    @Size(min=6, max=100, message="{Size.LoginForm.pswd}")
    private String pswd;
    //内部地址
    private String redirect;
    private int tries = 0;
    //随机的词调(?验证码)
    private String lexical;
    
    public String getNames() {
        return Commons.isNotBlank(names) ? names.trim() : "";
    }
    
    public void setNames(String names) {
        this.names = names;
    }
    
    public String getPswd() {
        return Commons.isNotBlank(pswd) ? pswd.trim() : "";
    }
    
    public void setPswd(String pswd) {
        this.pswd = pswd;
    }
    
    public String getRedirect() {
        return redirect;
    }
    
    public void setRedirect(String redirect) {
        this.redirect = redirect;
    }
    
    public int getTries() {
        return tries;
    }
    
    public void setTries(int tries) {
        this.tries = tries;
    }
    
    public String getLexical() {
        return lexical;
    }
    
    public void setLexical(String lexical) {
        this.lexical = lexical;
    }
}