log account deletion requests on rdrama

master
Aevann 2024-11-15 16:45:30 +02:00
parent 173fe441a7
commit c825beb305
4 changed files with 22 additions and 32 deletions

View File

@ -40,8 +40,6 @@ from .currency_logs import *
if FEATURES['IP_LOGGING']: if FEATURES['IP_LOGGING']:
from .ip_logs import * from .ip_logs import *
if FEATURES['ACCOUNT_DELETION']:
from .account_deletion import *
from .edit_logs import * from .edit_logs import *
from .chats import * from .chats import *
from .account_deletion import *

View File

@ -374,6 +374,7 @@ GET_HELP_MESSAGE = "Hi there,\n\nA [concerned user](/id/{vid}) reached out to us
if SITE_NAME == 'rDrama': if SITE_NAME == 'rDrama':
FEATURES['BLOCK_MUTE_EXILE_EXPIRY'] = True FEATURES['BLOCK_MUTE_EXILE_EXPIRY'] = True
FEATURES['ACCOUNT_DELETION'] = False
DEFAULT_PRONOUNS = 'they/them' DEFAULT_PRONOUNS = 'they/them'
@ -962,8 +963,6 @@ BADGE_BLACKLIST = PATRON_BADGES + ( # only grantable by admins higher than PERMS
) )
if SITE in {'rdrama.net', 'staging.rdrama.net'}: if SITE in {'rdrama.net', 'staging.rdrama.net'}:
FEATURES['ACCOUNT_DELETION'] = False
NOTIFICATION_SPAM_AGE_THRESHOLD = 0.5 * 86400 NOTIFICATION_SPAM_AGE_THRESHOLD = 0.5 * 86400
TELEGRAM_ID = "rdramanet" TELEGRAM_ID = "rdramanet"

View File

@ -1175,29 +1175,26 @@ def settings_age(v):
return {"message": "Age successfully updated!"} return {"message": "Age successfully updated!"}
@app.post("/settings/delete_account")
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def settings_delete_account(v):
submitted_password = request.values.get("password", "").strip()
if not v.verifyPass(submitted_password):
stop(400, "Incorrect password!")
if FEATURES['ACCOUNT_DELETION']: account_deletion = AccountDeletion(user_id=v.id)
@app.post("/settings/delete_account") g.db.add(account_deletion)
@limiter.limit('1/second', scope=rpath)
@limiter.limit('1/second', scope=rpath, key_func=get_ID)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400)
@limiter.limit(DEFAULT_RATELIMIT, deduct_when=lambda response: response.status_code < 400, key_func=get_ID)
@auth_required
def settings_delete_account(v):
submitted_password = request.values.get("password", "").strip()
if not v.verifyPass(submitted_password):
stop(400, "Incorrect password!")
v.login_nonce += 1 if not FEATURES['ACCOUNT_DELETION']:
g.db.add(v)
account_deletion = AccountDeletion(user_id=v.id)
g.db.add(account_deletion)
return render_template("message.html",
title="Your account will be deleted in 30 days.",
message="You can (and should) log back in before then to cancel this. Not that we want you here or anything. Whatever bitch."), 202
else:
@app.get("/settings/delete_account")
def settings_delete_account():
return redirect(f"{SITE_FULL_IMAGES}/i/mrburns.webp") return redirect(f"{SITE_FULL_IMAGES}/i/mrburns.webp")
v.login_nonce += 1
g.db.add(v)
return render_template("message.html",
title="Your account will be deleted in 30 days.",
message="You can (and should) log back in before then to cancel this. Not that we want you here or anything. Whatever bitch."), 202

View File

@ -137,11 +137,7 @@
</div> </div>
<div class="footer"> <div class="footer">
<div class="d-flex"> <div class="d-flex">
{% if FEATURES['ACCOUNT_DELETION'] %} <input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Request Account Deletion">
<input autocomplete="off" class="btn btn-primary ml-auto" type="submit" value="Request Account Deletion">
{% else %}
<a class="btn btn-primary ml-auto" href="/settings/delete_account">Request Account Deletion</a>
{% endif %}
</div> </div>
</div> </div>
</form> </form>