mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Add password error to not display password in plain text
This commit is contained in:
parent
d8ad8f5e09
commit
f5874d701a
@ -55,6 +55,7 @@ class UsersController:
|
||||
"minLength": self.helper.minimum_password_length,
|
||||
"examples": ["crafty"],
|
||||
"title": "Password",
|
||||
"error": "passLength",
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
|
@ -2,6 +2,7 @@ import logging
|
||||
import json
|
||||
from jsonschema import validate
|
||||
from jsonschema.exceptions import ValidationError
|
||||
from app.classes.shared.translation import Translation
|
||||
from app.classes.models.crafty_permissions import EnumPermissionsCrafty
|
||||
from app.classes.models.roles import Roles, HelperRoles
|
||||
from app.classes.models.users import PUBLIC_USER_ATTRS
|
||||
@ -54,6 +55,7 @@ class ApiUsersIndexHandler(BaseApiHandler):
|
||||
)
|
||||
|
||||
def post(self):
|
||||
self.translator = Translation(self.helper)
|
||||
new_user_schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -87,12 +89,17 @@ class ApiUsersIndexHandler(BaseApiHandler):
|
||||
try:
|
||||
validate(data, new_user_schema)
|
||||
except ValidationError as e:
|
||||
err = self.translator.translate(
|
||||
"validators",
|
||||
e.schema["error"],
|
||||
self.controller.users.get_user_lang_by_id(auth_data[4]["user_id"]),
|
||||
)
|
||||
return self.finish_json(
|
||||
400,
|
||||
{
|
||||
"status": "error",
|
||||
"error": "INVALID_JSON_SCHEMA",
|
||||
"error_data": str(e),
|
||||
"error_data": f"{str(err)}",
|
||||
},
|
||||
)
|
||||
username = data["username"]
|
||||
|
@ -650,6 +650,9 @@
|
||||
"userTheme": "UI Theme",
|
||||
"uses": "Number of uses allowed (-1==No Limit)"
|
||||
},
|
||||
"validators": {
|
||||
"passLength": "Password Too Short. Minimum Length: 8"
|
||||
},
|
||||
"webhooks": {
|
||||
"areYouSureDel": "Are you sure you want to delete this webhook?",
|
||||
"areYouSureRun": "Are you sure you want to test this webhook?",
|
||||
@ -675,4 +678,4 @@
|
||||
"webhook_body": "Webhook Body",
|
||||
"webhooks": "Webhooks"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user