/*
- * Sone - LoginPage.java - Copyright © 2010 David Roden
+ * Sone - LoginPage.java - Copyright © 2010–2013 David Roden
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
import net.pterodactylus.util.template.Template;
import net.pterodactylus.util.template.TemplateContext;
import net.pterodactylus.util.web.Method;
+
import freenet.clients.http.ToadletContext;
+import com.google.common.base.Optional;
+
/**
* The login page manages logging the user in.
*
templateContext.set("sones", localSones);
if (request.getMethod() == Method.POST) {
String soneId = request.getHttpRequest().getPartAsStringFailsafe("sone-id", 100);
- Sone selectedSone = webInterface.getCore().getLocalSone(soneId, false);
- if (selectedSone != null) {
- setCurrentSone(request.getToadletContext(), selectedSone);
+ Optional<Sone> selectedSone = webInterface.getCore().getLocalSone(soneId);
+ if (selectedSone.isPresent()) {
+ setCurrentSone(request.getToadletContext(), selectedSone.get());
String target = request.getHttpRequest().getParam("target");
if ((target == null) || (target.length() == 0)) {
target = "index.html";