Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Birin Sanchez
Keel - LDH Middleware
Commits
f76fe7b7
Commit
f76fe7b7
authored
May 08, 2019
by
Noe Nieto
💬
Browse files
Fix bad words validation ;Purism/LibremOne/task#35
parent
9b120d57
Changes
3
Hide whitespace changes
Inline
Side-by-side
cart/views.py
View file @
f76fe7b7
...
...
@@ -23,8 +23,10 @@ User = get_user_model()
def
validate_reserved_names
(
value
):
if
value
in
settings
.
REG_BAD_SUBSTRINGS
:
raise
ValidationError
(
validators
.
RESERVED_NAME
,
code
=
'invalid'
)
# premature optimization is the root of all evil
for
bad_word
in
settings
.
REG_BAD_SUBSTRINGS
:
if
bad_word
in
value
:
raise
ValidationError
(
validators
.
RESERVED_NAME
,
code
=
'invalid'
)
class
CartRegistrationForm
(
RegistrationForm
):
...
...
config_sample/ldh_middleware/config.ini
View file @
f76fe7b7
...
...
@@ -23,7 +23,7 @@ REG_PERSON_BASE_DN=ou=people,dc=example,dc=com
REG_PERSON_OBJECT_CLASSES
=
inetOrgPerson,organizationalPerson,person
REG_GROUP_BASE_DN
=
ou=groups,dc=example,dc=com
REG_GROUP_OBJECT_CLASSES
=
groupOfNames
REG_BAD_SUBSTRINGS
=
foo,bar,baz,solovino
REG_BAD_SUBSTRINGS
=
peanut,butter,jelly,time
AUTH_LDAP_SERVER_URI
=
ldap://ldap.example.com
AUTH_LDAP_START_TLS
=
True
AUTH_LDAP_BIND_DN
=
cn=admin,dc=example,dc=com
...
...
middleware/settings.py
View file @
f76fe7b7
...
...
@@ -87,7 +87,7 @@ REG_PERSON_OBJECT_CLASSES = config("REG_PERSON_OBJECT_CLASSES", cast=Csv())
REG_GROUP_BASE_DN
=
config
(
"REG_GROUP_BASE_DN"
)
REG_GROUP_OBJECT_CLASSES
=
config
(
"REG_GROUP_OBJECT_CLASSES"
,
cast
=
Csv
())
REG_BAD_SUBSTRINGS
=
config
.
get
(
"REG_BAD_SUBSTRINGS"
,
""
)
REG_BAD_SUBSTRINGS
=
config
.
get
(
"REG_BAD_SUBSTRINGS"
,
cast
=
Csv
(
str
)
)
#
# AUTHENTICATION
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment