]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/pages/account/MyDetailsForm.java
UPD: allow deleting of all names except first name.
[gigi.git] / src / org / cacert / gigi / pages / account / MyDetailsForm.java
index 848f349069bc21458b160c46721611c733107b93..74e454542dc8f6e6c4bdf159ce30a06ee12a759e 100644 (file)
@@ -2,7 +2,6 @@ package org.cacert.gigi.pages.account;
 
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
-import java.sql.SQLException;
 import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
@@ -43,7 +42,7 @@ public class MyDetailsForm extends Form {
                 String newLname = req.getParameter("lname").trim();
                 String newMname = req.getParameter("mname").trim();
                 String newSuffix = req.getParameter("suffix").trim();
-                if ((newFname.isEmpty() && !target.getFname().isEmpty()) || (newLname.isEmpty() && !target.getLname().isEmpty()) || (newMname.isEmpty() && !target.getMname().isEmpty()) || (newSuffix.isEmpty() && !target.getSuffix().isEmpty())) {
+                if (newFname.isEmpty() && !target.getFname().isEmpty()) {
                     throw new GigiApiException("Names couldn't be removed.");
                 }
                 target.setFname(newFname);
@@ -56,9 +55,6 @@ public class MyDetailsForm extends Form {
             } else {
                 throw new GigiApiException("No change after assurance allowed.");
             }
-        } catch (SQLException e) {
-            new GigiApiException(e).format(out, Page.getLanguage(req));
-            return false;
         } catch (GigiApiException e) {
             e.format(out, Page.getLanguage(req));
             return false;
@@ -76,16 +72,12 @@ public class MyDetailsForm extends Form {
         vars.put("lname", HTMLEncoder.encodeHTML(target.getLname()));
         vars.put("suffix", target.getSuffix() == null ? "" : HTMLEncoder.encodeHTML(target.getSuffix()));
         vars.put("details", "");
-        try {
-            if (target.getAssurancePoints() == 0) {
-                vars.put("DoB", ds);
-                templ.output(out, l, vars);
-            } else {
-                vars.put("DoB", DateSelector.getDateFormat().format(target.getDob()));
-                assured.output(out, l, vars);
-            }
-        } catch (SQLException e) {
-            e.printStackTrace();
+        if (target.getAssurancePoints() == 0) {
+            vars.put("DoB", ds);
+            templ.output(out, l, vars);
+        } else {
+            vars.put("DoB", DateSelector.getDateFormat().format(target.getDob()));
+            assured.output(out, l, vars);
         }
     }