Commit 5cf816ed authored by Mikaël Salson's avatar Mikaël Salson Committed by Mathieu Giraud

controllers/user.py, models/db.py: Define password_min_length for users

As users will be able to modify their own password, we need to give a limit on the minimal password length
parent 8ec13bef
Pipeline #43412 failed with stages
in 4 minutes and 51 seconds
......@@ -79,6 +79,8 @@ def edit_form():
error.append("password fields must match")
else:
password = db.auth_user.password.validate(request.vars["password"])[0]
if not password:
error.append("Password is too short, should be at least of length "+str(auth.settings.password_min_length))
if len(error) == 0:
data = dict(first_name = request.vars["first_name"],
......
......@@ -78,6 +78,8 @@ auth = VidjilAuth(db)
crud, service, plugins = Crud(db), Service(), PluginManager()
auth.settings.password_min_length = 6
## create all tables needed by auth if not custom tables
auth.define_tables(username=False, signature=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment