If there is only one local Sone, always be logged in as it.
[Sone.git] / src / main / java / net / pterodactylus / sone / web / WebInterface.java
index 13c7157..0df6d79 100644 (file)
@@ -309,6 +309,10 @@ public class WebInterface implements CoreListener {
         *         currently logged in
         */
        public Sone getCurrentSone(ToadletContext toadletContext, boolean create) {
+               Set<Sone> localSones = getCore().getLocalSones();
+               if (localSones.size() == 1) {
+                       return localSones.iterator().next();
+               }
                return getCurrentSone(getCurrentSession(toadletContext, create));
        }