import java.util.Calendar;
import java.util.Collections;
import java.util.HashSet;
+import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Set;
if ( !rs.next()) {
throw new GigiApiException("User not found... very bad.");
}
- if ( !PasswordHash.verifyHash(oldPass, rs.getString(1))) {
+ if (PasswordHash.verifyHash(oldPass, rs.getString(1)) == null) {
throw new GigiApiException("Old password does not match.");
}
rs.close();
}
}
+ public void setName(Name name) {
+ this.name = name;
+ }
+
public boolean canAssure() {
if ( !isOfAge(14)) { // PoJAM
return false;
return User.getById(rs.getInt(1));
}
+ public static User[] findByEmail(String mail) {
+ LinkedList<User> results = new LinkedList<User>();
+ GigiPreparedStatement ps = DatabaseConnection.getInstance().prepare("SELECT users.id FROM users inner join certOwners on certOwners.id=users.id WHERE users.email LIKE ? AND deleted is null GROUP BY users.id ASC LIMIT 100");
+ ps.setString(1, mail);
+ GigiResultSet rs = ps.executeQuery();
+ while (rs.next()) {
+ results.add(User.getById(rs.getInt(1)));
+ }
+ return results.toArray(new User[results.size()]);
+ }
+
public boolean canIssue(CertificateProfile p) {
switch (p.getCAId()) {
case 0:
return false;
}
}
+
}