Match changes to the Depot user repo commited in r....

Oh hello, git.
I mean... "change 4e5882cb4b89bb084ba3a63d6060323a2b371f98".
Yeah. Hm.

Anyway, fix validation records so that we only store one and it
corresponds to the latest email address.
This commit is contained in:
Ray J. Greenwell
2011-11-04 15:14:54 -07:00
parent 4e5882cb4b
commit 77b02552b1
@@ -943,20 +943,16 @@ public class OOOUserRepository extends UserRepository
/**
* Creates a pending record for an account that has been created but not yet validated (which
* involves the user accessing a secret URL we send to them in an email message). If a record
* already exists for the supplied user, it will be reused and returned.
* involves the user accessing a secret URL we send to them in an email message).
*/
public ValidateRecord createValidateRecord (int userId, boolean persist)
throws PersistenceException
{
// reuse an existing record if we have one
ValidateRecord rec = getValidateRecord(userId);
if (rec != null) {
return rec;
}
// delete any old validate mappings for the user
update("delete from penders where userId = '" + userId + "'");
// otherwise create a new one and insert it into the database
rec = new ValidateRecord();
// create a new one and insert it into the database
ValidateRecord rec = new ValidateRecord();
rec.secret = Long.toString(Math.abs((new Random()).nextLong()), 16);
rec.userId = userId;
rec.persist = persist;