Play Framework 1.2.3 (注册)

 public static void companyRegister(Company company,String password){

    String msg = "";

    if(company != null ){

    CompanyModel model = new CompanyModel();

    model.setUsername(company.username);

    model.setPassword(company.password);

    model.setDpassword(password);

    model.setEmail(company.email);

    model.setContactname(company.contactname);

    model.setContactmobile(company.contactmobile);

    if(model.getUsername() == null || model.getUsername().equals("")){

    msg = "用户名不能为空";

render("Application/register.html",msg,model);

    }

    if(model.getPassword() == null || model.getPassword().equals("")){

    msg = "密码不能为空";

render("Application/register.html",msg,model);

    }

    if(password == null ||password.equals("")){

    msg = "确认密码不能为空";

render("Application/register.html",msg,model);

    }

    if(!model.getPassword().equals(password)){

    msg = "密码和确认密码不一致请重新输入";

render("Application/register.html",msg,model);

    }

    if(model.getEmail() == null || model.getEmail().equals("")){

    msg = "邮箱不能为空";

render("Application/register.html",msg,model);

    }

    if(!CommonUtils.checkEmail(model.getEmail())){

    msg = "邮箱不合法请重新输入";

render("Application/register.html",msg,model);

    }

    if(model.getContactname() == null || model.getContactname().equals("")){

    msg = "联系人不能为空";

render("Application/register.html",msg,model);

    }

    if(model.getContactmobile() == null || model.getContactmobile().equals("")){

    msg = "手机号码不能为空";

render("Application/register.html",msg,model);

    }

    if(!CommonUtils.isMobileNO(model.getContactmobile())){

    msg = "手机号码不合法请重新输入";

render("Application/register.html",msg,model);

    }

    

    List<Company> listname = Company.q().filter("username",company.username.trim()).asList();

    if(listname.size() > 0){

    msg = "用户名已存在,请重新输入";

render("Application/register.html",msg,model);

    }

    

    List<Company> listeamil = Company.q().filter("email",company.email.trim()).asList();

    if(listeamil.size() > 0){

    msg = "此邮箱已经注册,请重新输入";

    render("Application/register.html",msg,model);

    }

    

    List<Company> listmobile = Company.q().filter("contactmobile",company.contactmobile.trim()).asList();

    if(listmobile.size() > 0){

    msg = "此手机已注册,请重新输入";

    render("Application/register.html",msg,model);

    }

    

    company.created = new Date();

    company.level = 1;

    company.save();

//    

    session.put("companyid", company.getId().toString());

//    session.put("groupid", company.groupid);

    session.put("username", company.username);

    

//    showMemberList(company.groupid, null);

    grouplist(null);

    }else {

    msg = "请填写注册信息!";

    render("Application/register.html",msg);

    }

    }

29140953_axwE.jpg


转载于:https://my.oschina.net/cpy/blog/485154

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值