+ this.name.lname = lname;
+ }
+ public void insert(String password) throws SQLException {
+ if (id != 0) {
+ throw new Error("refusing to insert");
+ }
+ PreparedStatement query = DatabaseConnection.getInstance().prepare(
+ "insert into `users` set `email`=?, `password`=?, "
+ + "`fname`=?, `mname`=?, `lname`=?, "
+ + "`suffix`=?, `dob`=?, `created`=NOW(), locked=0");
+ query.setString(1, email);
+ query.setString(2, PasswordHash.hash(password));
+ query.setString(3, name.fname);
+ query.setString(4, name.mname);
+ query.setString(5, name.lname);
+ query.setString(6, name.suffix);
+ query.setDate(7, new java.sql.Date(dob.getTime()));
+ query.execute();
+ id = DatabaseConnection.lastInsertId(query);
+ System.out.println("Inserted: " + id);
+ }
+
+ public boolean canAssure() throws SQLException {
+ if (getAssurancePoints() < 100) {
+ return false;
+ }
+
+ return hasPassedCATS();
+
+ }
+ public boolean hasPassedCATS() throws SQLException {
+ PreparedStatement query = DatabaseConnection.getInstance().prepare(
+ "SELECT 1 FROM `cats_passed` where `user_id`=?");
+ query.setInt(1, id);
+ ResultSet rs = query.executeQuery();
+ if (rs.next()) {
+ return true;
+ } else {
+ return false;
+ }