Commit 8f7cecde 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 8bc73636
Pipeline #96777 failed with stages
in 24 seconds
......@@ -81,6 +81,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"],
......
......@@ -79,6 +79,8 @@ auth.settings.two_factor_authentication_group = "auth2step"
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