X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FSoneTemplatePage.java;h=5f9ff5ddd8f4d6f1b494533908cde8c964ffd6c0;hb=b6e8e4eb71b7cfcb7cff892cca23d20925eabeb8;hp=49bd26d6493339383b02a16d2bf76f4cdb2c26b7;hpb=be893c81154fc559faa094d5440941db33d293e6;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java index 49bd26d..5f9ff5d 100644 --- a/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java +++ b/src/main/java/net/pterodactylus/sone/web/SoneTemplatePage.java @@ -100,18 +100,18 @@ public class SoneTemplatePage extends TemplatePage { /** * Returns the currently logged in Sone. * - * @param toadletContenxt + * @param toadletContext * The toadlet context * @return The currently logged in Sone, or {@code null} if no Sone is * currently logged in */ - protected Sone getCurrentSone(ToadletContext toadletContenxt) { - Session session = getCurrentSession(toadletContenxt); + protected Sone getCurrentSone(ToadletContext toadletContext) { + Session session = getCurrentSession(toadletContext); if (session == null) { return null; } String soneId = (String) session.getAttribute("Sone.CurrentSone"); - for (Sone sone : webInterface.core().localSones()) { + for (Sone sone : webInterface.core().getSones()) { if (sone.getId().equals(soneId)) { return sone; } @@ -162,6 +162,15 @@ public class SoneTemplatePage extends TemplatePage { * {@inheritDoc} */ @Override + protected void processTemplate(Request request, Template template) throws RedirectException { + super.processTemplate(request, template); + template.set("currentSone", getCurrentSone(request.getToadletContext())); + } + + /** + * {@inheritDoc} + */ + @Override protected String getRedirectTarget(Page.Request request) { if (requiresLogin() && (getCurrentSone(request.getToadletContext()) == null)) { return "login.html";