X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Forg%2Fcacert%2Fgigi%2FUser.java;h=0e1ee22ca51fc4a85a44dd77373cfe456cdf81cc;hb=e7d86f1ac66e3c7a8d0c95c3cf4abc5d49c9e68a;hp=0eed2b8c501cfd93aa20754535a20f5e3464c66a;hpb=2233a655b4ef4c1122a406e83a0e6334b9fd49b6;p=gigi.git diff --git a/src/org/cacert/gigi/User.java b/src/org/cacert/gigi/User.java index 0eed2b8c..0e1ee22c 100644 --- a/src/org/cacert/gigi/User.java +++ b/src/org/cacert/gigi/User.java @@ -268,11 +268,14 @@ public class User { return null; } - public void updateDefaultEmail(EmailAddress newMail) { + public void updateDefaultEmail(EmailAddress newMail) throws GigiApiException { try { EmailAddress[] adrs = getEmails(); for (int i = 0; i < adrs.length; i++) { if (adrs[i].getAddress().equals(newMail.getAddress())) { + if (!adrs[i].isVerified()) { + throw new GigiApiException("Email not verified."); + } PreparedStatement ps = DatabaseConnection.getInstance().prepare( "UPDATE users SET email=? WHERE id=?"); ps.setString(1, newMail.getAddress()); @@ -282,9 +285,9 @@ public class User { return; } } - throw new IllegalArgumentException("Given address not an address of the user."); + throw new GigiApiException("Given address not an address of the user."); } catch (SQLException e) { - e.printStackTrace(); + throw new GigiApiException(e); } }