fix import and checking ratelimit in routes

This commit is contained in:
fram3d committed 2026-10-24 04:14:33 +02:00
1 parent bcd0b10a2d
commit 87f67c14c6
1 file changed
+2 -1
+2 -1
View File
@@ -1,6 +1,7 @@
from flask import render_template, request, redirect from flask import render_template, request, redirect
from luser import app from luser import app
from luser.models import LUSER from luser.models import LUSER
from luser.models import ratelimit
from passlib.hash import ldap_salted_sha1,sha512_crypt from passlib.hash import ldap_salted_sha1,sha512_crypt
import subprocess import subprocess
import random import random
@@ -88,7 +89,7 @@ def unregister():
@app.route('/account/register/', methods=['POST', 'GET']) @app.route('/account/register/', methods=['POST', 'GET'])
def register(): def register():
rl = ratelimit(PERIOD, LIMIT, "/var/luser/luser/.ratelimit") rl = ratelimit(PERIOD, LIMIT, "/var/luser/luser/.ratelimit")
if rl.check(1): if rl.check(1) == False:
return 'Error: rate limit exceeded, please come again in ' + PERIOD return 'Error: rate limit exceeded, please come again in ' + PERIOD
if request.method == 'GET': if request.method == 'GET':
captcha_solution = str(random.randint(0,999999)) captcha_solution = str(random.randint(0,999999))