- Don't delete accounts that are already deleted!
- Don't use "-" when deleting accounts. - Truncate only after we've prepended the number and =. git-svn-id: https://samskivert.googlecode.com/svn/trunk@1480 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -344,6 +344,10 @@ public class UserRepository extends JORARepository
|
|||||||
public void deleteUser (final User user)
|
public void deleteUser (final User user)
|
||||||
throws PersistenceException
|
throws PersistenceException
|
||||||
{
|
{
|
||||||
|
if (user.isDeleted()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
execute(new Operation () {
|
execute(new Operation () {
|
||||||
public Object invoke (Connection conn, DatabaseLiaison liaison)
|
public Object invoke (Connection conn, DatabaseLiaison liaison)
|
||||||
throws PersistenceException, SQLException
|
throws PersistenceException, SQLException
|
||||||
@@ -357,20 +361,15 @@ public class UserRepository extends JORARepository
|
|||||||
// set the password to unusable
|
// set the password to unusable
|
||||||
user.password = "";
|
user.password = "";
|
||||||
|
|
||||||
String join = "=";
|
|
||||||
String newName = user.username;
|
|
||||||
if (newName.length() > 21) {
|
|
||||||
newName = newName.substring(0,21);
|
|
||||||
join = "-";
|
|
||||||
}
|
|
||||||
|
|
||||||
// 'disable' their email address
|
// 'disable' their email address
|
||||||
String newEmail = user.email.replace('@','#');
|
String newEmail = user.email.replace('@','#');
|
||||||
user.email = newEmail;
|
user.email = newEmail;
|
||||||
|
|
||||||
|
String oldName = user.username;
|
||||||
for (int ii = 0; ii < 100; ii++) {
|
for (int ii = 0; ii < 100; ii++) {
|
||||||
try {
|
try {
|
||||||
user.username = ii + join + newName;
|
user.username = StringUtil.truncate(
|
||||||
|
ii + "=" + oldName, 24);
|
||||||
_utable.update(user, mask);
|
_utable.update(user, mask);
|
||||||
return null; // nothing to return
|
return null; // nothing to return
|
||||||
} catch (SQLException se) {
|
} catch (SQLException se) {
|
||||||
|
|||||||
Reference in New Issue
Block a user