]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/account/ChangePasswordPage.java
upd: enforce a more strict Form call pattern.
[gigi.git] / src / org / cacert / gigi / pages / account / ChangePasswordPage.java
index 1919f544efd81ba52d8d5245912a1f4b0db2a00c..60cfaa0b33ceacd7735685ebad8aca9d690fa6d1 100644 (file)
@@ -6,18 +6,25 @@ import java.util.HashMap;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.cacert.gigi.pages.Page;
+import org.cacert.gigi.dbObjects.User;
+import org.cacert.gigi.pages.ManagedFormPage;
+import org.cacert.gigi.util.AuthorizationContext;
 
-public class ChangePasswordPage extends Page {
-       public static final String PATH = "/account/password";
+public class ChangePasswordPage extends ManagedFormPage {
 
-       public ChangePasswordPage() {
-               super("Change Password");
-       }
+    public static final String PATH = "/account/password";
 
-       @Override
-       public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
-               new ChangeForm(req).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
-       }
+    public ChangePasswordPage() {
+        super("Change Password", ChangeForm.class);
+    }
 
+    @Override
+    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
+        new ChangeForm(req, getUser(req)).output(resp.getWriter(), getLanguage(req), new HashMap<String, Object>());
+    }
+
+    @Override
+    public boolean isPermitted(AuthorizationContext ac) {
+        return ac != null && ac.getTarget() instanceof User;
+    }
 }