Package org.jnode.httpd.dto

Examples of org.jnode.httpd.dto.PointRequest


    String point = req.queryParams("point");
    String fname = req.queryParams("fname");
    String lname = req.queryParams("lname");
    String email = req.queryParams("email");

    PointRequest pr = new PointRequest();
    // check node
    try {
      FtnAddress a = new FtnAddress(node);
      if (!MainHandler.getCurrentInstance().getInfo().getAddressList()
          .contains(a)) {
        code = "NOTNODE";
      }
    } catch (NumberFormatException e) {
      code = "NOTNODE";
    }
    if (code == null) {
      try {
        FtnAddress a = new FtnAddress(node + "." + point);
        if (null != FtnTools.getLinkByFtnAddress(a)) {
          code = "EXISTS";
        }
        pr.setAddr(a.toString());
      } catch (NumberFormatException e) {
        code = "NOTPOINT";
      }
    }
    if (code == null) {
      if (fname != null && lname != null && fname.length() > 3
          && lname.length() >= 3) {
        pr.setName(fname + " " + lname);
      } else {
        code = "NOTNAME";
      }
    }
    if (code == null) {
      if (email != null
          && email.matches("^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$")) {
        pr.setEmail(email);
      } else {
        code = "NOTEMAIL";
      }
    }
    if (code == null) {
      String password = FtnTools.generate8d();
      pr.setPassword(password);
      synchronized (PointRequest.class) {
        if (null != ORMManager.get(PointRequest.class).getFirstAnd(
            "addr", "=", pr.getAddr())) {
          code = "EXISTS";
        } else {
          ORMManager.get(PointRequest.class).save(pr);
          writeRequestNetmail(pr);
          writeConfirmEmail(req, pr);
View Full Code Here


  @Override
  public Object handle(Request req, Response resp) {
    String key = req.queryParams("key");
    String text = "";
    if (key != null) {
      PointRequest pr = ORMManager.get(PointRequest.class).getById(key);
      if (pr != null) {
        synchronized (PointRequest.class) {
          if (null == ORMManager.get(Link.class).getFirstAnd(
              "ftn_address", "=", pr.getAddr())) {
            Link l = new Link();
            l.setLinkName(pr.getName());
            l.setLinkAddress(pr.getAddr());
            l.setPaketPassword(pr.getPassword());
            l.setProtocolHost("-");
            l.setProtocolPort(0);
            l.setProtocolPassword(pr.getPassword());
            ORMManager.get(Link.class).save(l);
            ORMManager.get(PointRequest.class).delete(pr);
            writeMails(pr);
            text = "Проверьте вашу почту для получения дальнейших инструкций";
          } else {
View Full Code Here

TOP

Related Classes of org.jnode.httpd.dto.PointRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.