}
public EmailAddress(String address, User owner) {
+ if (!EmailProvider.MAIL.matcher(address).matches()) {
+ throw new IllegalArgumentException("Invalid email.");
+ }
this.address = address;
this.owner = owner;
this.hash = RandomToken.generateToken(16);
ps2.setInt(1, owner.getId());
ps2.setString(2, address);
ps2.execute();
+ this.hash = "";
} catch (SQLException e) {
throw new GigiApiException(e);
}
throw new IllegalArgumentException(e);
}
}
+
+ public boolean isVerified() {
+ return hash.isEmpty();
+ }
}