package com.apobates.forum.thrones.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 20200516
 */
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;
    //客户端缓存的cookie标记.以减少查询会员状态的请求@20200502
    private String trace;
    
    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;
    }
    
    public String getTrace() {
        return trace;
    }
    
    public void setTrace(String trace) {
        this.trace = trace;
    }
}