]> WPIA git - gigi.git/blobdiff - src/org/cacert/gigi/dbObjects/User.java
fix: npe in domain overview as domain
[gigi.git] / src / org / cacert / gigi / dbObjects / User.java
index 2bc1e563e971a235ed071bb728bb3b3e29880bb3..e6afc79666c60f1cf07540b893f08d309a3a4b3a 100644 (file)
@@ -312,8 +312,7 @@ public class User extends CertificateOwner {
 
     public void updateUserData() throws GigiApiException {
         synchronized (Notary.class) {
-            // FIXME: No assurance, not no points.
-            if (getAssurancePoints() != 0) {
+            if (getReceivedAssurances().length != 0) {
                 throw new GigiApiException("No change after assurance allowed.");
             }
             rawUpdateUserData();
@@ -513,13 +512,13 @@ public class User extends CertificateOwner {
             if ( !rs.next()) {
                 throw new GigiApiException("Token not found... very bad.");
             }
-            ps = DatabaseConnection.getInstance().prepare("UPDATE `passwordResetTickets` SET  `used` = CURRENT_TIMESTAMP WHERE `id`=?");
-            ps.setInt(1, id);
-            ps.executeUpdate();
             if (PasswordHash.verifyHash(private_token, rs.getString(1)) == null) {
                 throw new GigiApiException("Private token does not match.");
             }
             setPassword(newPassword);
+            ps = DatabaseConnection.getInstance().prepare("UPDATE `passwordResetTickets` SET  `used` = CURRENT_TIMESTAMP WHERE `id`=?");
+            ps.setInt(1, id);
+            ps.executeUpdate();
         }
     }