Пример #1
0
 private void load() {
   secrets.clear();
   Map<String, Row> contacts = lookupCache.CONTACTS.getValue(true);
   for (Row contact : contacts.values()) {
     String name = contact.string(Contacts.PERSON);
     String password = contact.string(Contacts.PASSWORD);
     // if password is null or empty, do not add to secrets list!
     if (password != null && password.trim().length() > 0) {
       getLogger().info("enabling user " + name + ", hash '" + password + "'");
       try {
         secrets.put(name, Passwords.decode(password).toCharArray());
       } catch (Exception ex) {
         throw new RuntimeException("could not decode password", ex);
       }
     }
   }
 }
Пример #2
0
 @Override
 protected ResourceTemplate buildTemplate() throws DAOException, TemplateException {
   SimpleHash model = new SimpleHash();
   Row page =
       dao(ProductPage.class).getProductPage((String) getRequest().getAttributes().get("id"));
   model.put("stationname", page.string(ProductPage.STATIONNAME));
   model.put("stationclass", page.string(ProductPage.STATIONCLASS));
   model.put("region", page.string(ProductPage.REGION));
   String processName = Hardcoded.getProcessDisplayName(page.string(ProductPage.PROCESS));
   model.put("process", processName);
   String productname = lookup().PRODUCT_TYPES.getValue().get(page.value(ProductPage.NAMEID));
   model.put("name", productname);
   model.put("quality", page.string(ProductPage.QUALITY));
   String creator = page.string(ProductPage.PERSON) + " <" + page.string(ProductPage.EMAIL) + ">";
   model.put("creator", creator);
   ResourceTemplate template = ResourceTemplate.get("product-page.html", "product", model);
   return template;
 }