mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-10 23:17:37 +01:00
Delete unconfirmed accounts after 12 hours
This commit is contained in:
parent
bc371f1ef3
commit
c0eb10521d
@ -280,3 +280,11 @@ def import_licenses():
|
|||||||
db.session.add(obj)
|
db.session.add(obj)
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
|
|
||||||
|
@action("Delete inactive users")
|
||||||
|
def delete_inactive_users():
|
||||||
|
users = User.query.filter(User.is_active==False, User.packages==None, User.forum_topics==None, User.rank==UserRank.NOT_JOINED).all()
|
||||||
|
for user in users:
|
||||||
|
db.session.delete(user)
|
||||||
|
db.session.commit()
|
@ -25,12 +25,12 @@ There are a number of reasons this may have happened:
|
|||||||
* Email has been unsubscribed.
|
* Email has been unsubscribed.
|
||||||
|
|
||||||
If the email doesn't arrive after registering by email, then you'll need to try registering again in 12 hours.
|
If the email doesn't arrive after registering by email, then you'll need to try registering again in 12 hours.
|
||||||
Unconfirmed accounts are deleted every 12 hours.
|
Unconfirmed accounts are deleted after 12 hours.
|
||||||
|
|
||||||
If the email verification was sent using the Email settings tab, then you can just set a new email.
|
If the email verification was sent using the Email settings tab, then you can just set a new email.
|
||||||
|
|
||||||
If you have previously unsubscribed this email, then ContentDB is completely prevented from sending emails to that
|
If you have previously unsubscribed this email, then ContentDB is completely prevented from sending emails to that
|
||||||
address. You'll need to use a different email address, or [contact an admin](https://rubenwardy.com/contact/) to
|
address. You'll need to use a different email address, or [contact rubenwardy](https://rubenwardy.com/contact/) to
|
||||||
remove your email from the blacklist.
|
remove your email from the blacklist.
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,13 +87,13 @@ CELERYBEAT_SCHEDULE = {
|
|||||||
'schedule': crontab(minute=0, hour=14), # 1400
|
'schedule': crontab(minute=0, hour=14), # 1400
|
||||||
},
|
},
|
||||||
'delete_inactive_users': {
|
'delete_inactive_users': {
|
||||||
'task': 'app.tasks.users.delete_inactive_users',
|
'task': 'app.tasks.usertasks.delete_inactive_users',
|
||||||
'schedule': crontab(minute=15), # every hour at quarter past
|
'schedule': crontab(minute=15), # every hour at quarter past
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
celery.conf.beat_schedule = CELERYBEAT_SCHEDULE
|
celery.conf.beat_schedule = CELERYBEAT_SCHEDULE
|
||||||
|
|
||||||
from . import importtasks, forumtasks, emails, pkgtasks, celery
|
from . import importtasks, forumtasks, emails, pkgtasks, usertasks
|
||||||
|
|
||||||
|
|
||||||
# noinspection PyUnusedLocal
|
# noinspection PyUnusedLocal
|
||||||
|
@ -16,11 +16,16 @@
|
|||||||
|
|
||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
from app.models import User
|
from app.models import User, db, UserRank
|
||||||
from app.tasks import celery
|
from app.tasks import celery
|
||||||
|
|
||||||
|
|
||||||
@celery.task()
|
@celery.task()
|
||||||
def delete_inactive_users():
|
def delete_inactive_users():
|
||||||
threshold = datetime.datetime.now() - datetime.timedelta(hours=12)
|
threshold = datetime.datetime.now() - datetime.timedelta(hours=5)
|
||||||
User.query.filter(User.is_active==False, User.packages==None, User.created_at<=threshold).delete()
|
|
||||||
|
users = User.query.filter(User.is_active==False, User.packages==None, User.forum_topics==None, User.created_at<=threshold, User.rank==UserRank.NOT_JOINED).all()
|
||||||
|
for user in users:
|
||||||
|
db.session.delete(user)
|
||||||
|
|
||||||
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user