Compare commits
2
Commits
4445aa08c7
..
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8caf2bddbc
|
||
|
|
bcd0b10a2d
|
No files matched your search
@@ -9,6 +9,7 @@ A lightweight user management system for LDAP, implemented using Flask. This app
|
||||
- **User Unregistration**: Users can remove themselves from the LDAP system.
|
||||
- **Captcha Protection**: Uses a custom captcha mechanism to mitigate bot registrations.
|
||||
- **LDAP Integration**: Directly interacts with LDAP for all credential and user management tasks.
|
||||
- **Rate limiting** (new): Setting rate limiting for user registration.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
@@ -37,6 +38,8 @@ A lightweight user management system for LDAP, implemented using Flask. This app
|
||||
- `LDAPPASS`: Admin password for LDAP operations.
|
||||
- `USERBASE`: The base DN for users.
|
||||
- `CAPTCHA_PATH`: Path where captcha images are stored.
|
||||
- `PERIOD`: Time period after which the rate limiting counter resets
|
||||
- `LIMIT`: Number of allowed user registrations in the given time PERIOD
|
||||
|
||||
4. **Setup Captcha script**:
|
||||
Ensure the `captcha.sh` script is available in `/usr/local/bin/` and is executable.
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
from flask import render_template, request, redirect
|
||||
from luser import app
|
||||
from luser.models import LUSER
|
||||
from luser.models import ratelimit
|
||||
from passlib.hash import ldap_salted_sha1,sha512_crypt
|
||||
import subprocess
|
||||
import random
|
||||
@@ -88,7 +89,7 @@ def unregister():
|
||||
@app.route('/account/register/', methods=['POST', 'GET'])
|
||||
def register():
|
||||
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
|
||||
if request.method == 'GET':
|
||||
captcha_solution = str(random.randint(0,999999))
|
||||
|
||||
Reference in new issue
Block a user