diff --git a/bubble-server/src/main/java/bubble/cloud/auth/AuthenticationDriver.java b/bubble-server/src/main/java/bubble/cloud/auth/AuthenticationDriver.java index d854d920..5101b306 100644 --- a/bubble-server/src/main/java/bubble/cloud/auth/AuthenticationDriver.java +++ b/bubble-server/src/main/java/bubble/cloud/auth/AuthenticationDriver.java @@ -14,17 +14,23 @@ import bubble.server.BubbleConfiguration; import bubble.service.account.StandardAccountMessageService; import com.github.jknack.handlebars.Handlebars; import org.apache.commons.collections4.map.SingletonMap; +import org.apache.commons.lang3.ArrayUtils; import org.cobbzilla.util.handlebars.HandlebarsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import static org.cobbzilla.util.daemon.ZillaRuntime.die; +import static org.cobbzilla.util.io.FileUtil.basename; import static org.cobbzilla.util.io.StreamUtil.stream2string; public interface AuthenticationDriver extends CloudServiceDriver { + Logger log = LoggerFactory.getLogger(AuthenticationDriver.class); + String CTX_LOCALE = "locale"; default BubbleConfiguration getConfiguration() { return die("getConfiguration: not implemented!"); } @@ -107,13 +113,13 @@ public interface AuthenticationDriver extends CloudServiceDriver { } catch (Exception e) { final String defaultLocale = configuration.getDefaultLocale(); if (locale.equals(defaultLocale)) { - return die("loadTemplate: no default template found: "+path); + return handleTemplateNotFound(templateName, path); } final String defaultPath = localePath(defaultLocale, templatePath, handlebars) + "/" + templateName; try { return stream2string(defaultPath); } catch (Exception e2) { - return die("loadTemplate: no default template found: "+defaultPath); + return handleTemplateNotFound(templateName, path); } } } @@ -126,4 +132,17 @@ public interface AuthenticationDriver extends CloudServiceDriver { k -> HandlebarsUtil.apply(hbs, templatePath, new SingletonMap<>(CTX_LOCALE, locale), '[', ']')); } + String HTML_MESSAGE_HBS = "htmlMessage.hbs"; + String[] OPTIONAL_TEMPLATES = {HTML_MESSAGE_HBS}; + static String[] getOptionalTemplates() { return OPTIONAL_TEMPLATES; } + + static String handleTemplateNotFound(String templateName, String path) { + if (ArrayUtils.contains(getOptionalTemplates(), basename(templateName))) { + log.warn("loadTemplate: no (optional) default template found: "+path); + return null; + } else { + return die("loadTemplate: no default template found: " + path); + } + } + } diff --git a/bubble-web b/bubble-web index 6278ddb7..eb9d2441 160000 --- a/bubble-web +++ b/bubble-web @@ -1 +1 @@ -Subproject commit 6278ddb7067c668ceb676a9289e99fe734bdce89 +Subproject commit eb9d244107c7949075d6767be10b85d26bf3b4e9 diff --git a/utils/cobbzilla-wizard b/utils/cobbzilla-wizard index 577bcd1f..dc43c3c6 160000 --- a/utils/cobbzilla-wizard +++ b/utils/cobbzilla-wizard @@ -1 +1 @@ -Subproject commit 577bcd1f18224f11dcc467be725b9ca786e6aa37 +Subproject commit dc43c3c657d55db2058a924cb345672383e50f14