Package org.jnode.httpd.dto

Examples of org.jnode.httpd.dto.WebAdmin


    Spark.post(new RoutingRoute());
    Spark.post(new RewriteRoute());
    Spark.post(new UserRoute());

    try {
      WebAdmin admin = ORMManager.get(WebAdmin.class).getFirstAnd();
      if (admin == null) {
        admin = new WebAdmin();
        admin.setUsername("admin");
        String password = FtnTools.generate8d();
        admin.setPassword(FtnTools.md5(password));
        ORMManager.get(WebAdmin.class).save(admin);
        String text = "You can login to jNode site with those credentials:\n  > login: admin\n > password "
            + password + "\n";
        // write netmail to primary address
        FtnTools.writeNetmail(FtnTools.getPrimaryFtnAddress(),
View Full Code Here


      } else {
        try {
          String authText = new String(Base64Util.decode(authBase64
              .split(" ")[1]));
          String[] creds = authText.split(":");
          WebAdmin admin = ORMManager.get(WebAdmin.class)
              .getFirstAnd("username", "=", creds[0]);
          if (admin != null) {
            String password = FtnTools.md5(creds[1]);
            if (password.equals(admin.getPassword())) {
              authenticated = true;
              cache.put(authBase64, authenticated);
            }
          }
        } catch (RuntimeException e) {
View Full Code Here

    String code = null;
    if ("delete".equals(action)) {
      String id = req.queryParams("id");
      try {
        Long lid = Long.valueOf(id);
        WebAdmin admin = ORMManager.get(WebAdmin.class).getById(lid);
        if (admin != null)
          ORMManager.get(WebAdmin.class).delete(admin);
      } catch (RuntimeException e) {
        code = "ERROR";
        e.printStackTrace();
      }
    } else if ("password".equals(action)) {
      String id = req.queryParams("id");
      String password = req.queryParams("password");
      try {
        Long lid = Long.valueOf(id);
        WebAdmin admin = ORMManager.get(WebAdmin.class).getById(lid);
        if (admin != null) {
          admin.setPassword(FtnTools.md5(password));
          ORMManager.get(WebAdmin.class).update(admin);
        }
      } catch (RuntimeException e) {
        code = "ERROR";
        e.printStackTrace();
      }
    } else if ("create".equals(action)) {
      String username = req.queryParams("username");
      String password = req.queryParams("password");
      WebAdmin admin = new WebAdmin();
      admin.setUsername(username);
      admin.setPassword(FtnTools.md5(password));
      ORMManager.get(WebAdmin.class).save(admin);
    } else {
      code = "ERROR";
    }
    resp.header("Location", "/secure/users.html"
View Full Code Here

TOP

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

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.