public void addPing(DomainPingType type, String config) throws GigiApiException {
try (GigiPreparedStatement ps = new GigiPreparedStatement("INSERT INTO `pingconfig` SET `domainid`=?, `type`=?::`pingType`, `info`=?")) {
ps.setInt(1, id);
- ps.setString(2, type.toString().toLowerCase());
+ ps.setEnum(2, type);
ps.setString(3, config);
ps.execute();
}
try (GigiPreparedStatement ps = new GigiPreparedStatement("UPDATE `domainPinglog` SET `state`='success' WHERE `challenge`=? AND `state`='open' AND `configId` IN (SELECT `id` FROM `pingconfig` WHERE `domainid`=? AND `type`='email')")) {
ps.setString(1, hash);
ps.setInt(2, id);
- ps.executeUpdate();
+ if ( !ps.executeMaybeUpdate()) {
+ throw new IllegalArgumentException("Given token could not be found to complete the verification process (Domain Ping).");
+ }
}
}