Only allow local Sones to log in.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 30 Nov 2010 04:49:24 +0000 (05:49 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 30 Nov 2010 04:49:24 +0000 (05:49 +0100)
src/main/java/net/pterodactylus/sone/web/LoginPage.java

index 1e281b5..6c3e5c5 100644 (file)
@@ -68,13 +68,7 @@ public class LoginPage extends SoneTemplatePage {
                template.set("sones", localSones);
                if (request.getMethod() == Method.POST) {
                        String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone-id", 100);
-                       Sone selectedSone = null;
-                       for (Sone sone : webInterface.getCore().getSones()) {
-                               if (sone.getId().equals(soneId)) {
-                                       selectedSone = sone;
-                                       break;
-                               }
-                       }
+                       Sone selectedSone = webInterface.getCore().getLocalSone(soneId);
                        if (selectedSone != null) {
                                setCurrentSone(request.getToadletContext(), selectedSone);
                                throw new RedirectException("index.html");