Store the form password.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 22 Oct 2010 14:02:58 +0000 (16:02 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 22 Oct 2010 14:02:58 +0000 (16:02 +0200)
src/main/java/net/pterodactylus/sone/web/WebInterface.java

index b4a0510..ec20785 100644 (file)
@@ -75,6 +75,9 @@ public class WebInterface extends AbstractService {
        /** The registered toadlets. */
        private final List<PageToadlet> pageToadlets = new ArrayList<PageToadlet>();
 
+       /** The form password. */
+       private final String formPassword;
+
        /**
         * Creates a new web interface.
         *
@@ -84,6 +87,7 @@ public class WebInterface extends AbstractService {
        public WebInterface(SonePlugin sonePlugin) {
                super("Sone Web Interface", false);
                this.sonePlugin = sonePlugin;
+               formPassword = sonePlugin.pluginRespirator().getToadletContainer().getFormPassword();
        }
 
        //
@@ -122,6 +126,15 @@ public class WebInterface extends AbstractService {
                }
        }
 
+       /**
+        * Returns the node’s form password.
+        *
+        * @return The form password
+        */
+       public String formPassword() {
+               return formPassword;
+       }
+
        //
        // SERVICE METHODS
        //
@@ -162,7 +175,7 @@ public class WebInterface extends AbstractService {
                templateFactory.addPlugin("getpage", new GetPagePlugin());
                templateFactory.addPlugin("paginate", new PaginationPlugin());
                templateFactory.setTemplateProvider(new ClassPathTemplateProvider(templateFactory));
-               templateFactory.addTemplateObject("formPassword", sonePlugin.pluginRespirator().getToadletContainer().getFormPassword());
+               templateFactory.addTemplateObject("formPassword", formPassword);
 
                Template loginTemplate = templateFactory.createTemplate(createReader("/templates/login.html"));
                Template indexTemplate = templateFactory.createTemplate(createReader("/templates/index.html"));