public static void companyLogin(String username,String password){
log.info("start companyLogin method parameter username:" + username + "password:" + password);
String msg = "";
CompanyModel model = new CompanyModel();
model.setUsername(username);
model.setPassword(password);
if(model.getUsername() == null || model.getUsername().equals("")){
msg = "用户名不能为空";
render("Application/login.html",msg,model);
}
if(model.getPassword() == null || model.getPassword().equals("")){
msg = "密码不能为空";
render("Application/login.html",msg);
}
log.info("get request info " + "ip:" + request.host + "port:" + request.port);
if(Application.isCheckUserName(username)){
List<Company> list = Company.q().filter("username", username).filter("password", password).asList();
if(list.size() > 0){
log.info("loggin success" );
msg = "登录成功欢迎";
Company company = list.get(0);
session.put("companyid", company.getId());
// session.put("groupid", company.groupid);
session.put("username", company.username);
log.info("start companyLogin method");
// showMemberList(company.groupid,null);
grouplist(null);
}else{
log.info("loggin error");
msg = "您输入的密码和用户名不匹配,请重新输入";
log.info("start companyLogin method");
render("Application/login.html",msg,model);
}
}else{
msg = "用户名不存,请重新输入";
render("Application/login.html",msg,model);
}
}