Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Eteri
erp5_fork
Commits
7e9f03f3
Commit
7e9f03f3
authored
Aug 15, 2011
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow UI to show all password validation error messages by extending
API. Adjust test accordingly.
parent
65610e6b
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
190 additions
and
99 deletions
+190
-99
product/ERP5/interfaces/login_account_provider.py
product/ERP5/interfaces/login_account_provider.py
+7
-0
product/ERP5/mixin/login_account_provider.py
product/ERP5/mixin/login_account_provider.py
+20
-7
product/ERP5/tests/testAuthenticationPolicy.py
product/ERP5/tests/testAuthenticationPolicy.py
+163
-92
No files found.
product/ERP5/interfaces/login_account_provider.py
View file @
7e9f03f3
...
@@ -59,6 +59,13 @@ class ILoginAccountProvider(Interface):
...
@@ -59,6 +59,13 @@ class ILoginAccountProvider(Interface):
"""
"""
Is password valid?
Is password valid?
"""
"""
def
analyzePassword
(
password
,
**
kw
):
"""
Analyze password validity.
Return status code indicating if password is acceptable and if not status code
for reason for not being a valid one (i.e. too short, not complex, etc ...)
"""
def
isPasswordAlreadyUsed
(
self
,
password
):
def
isPasswordAlreadyUsed
(
self
,
password
):
"""
"""
...
...
product/ERP5/mixin/login_account_provider.py
View file @
7e9f03f3
...
@@ -82,10 +82,19 @@ class LoginAccountProviderMixin:
...
@@ -82,10 +82,19 @@ class LoginAccountProviderMixin:
"""
"""
Is password valid?
Is password valid?
"""
"""
method
=
self
.
_getTypeBasedMethod
(
'isPasswordValid'
)
result_code_list
=
self
.
analyzePassword
(
password
,
**
kw
)
if
method
is
not
None
:
if
not
len
(
result_code_list
):
return
method
(
password
,
**
kw
)
return
True
return
True
return
False
def
analyzePassword
(
self
,
password
,
**
kw
):
"""
Analyze password validity.
Return status code indicating if password is acceptable and if not status code
for reason for not being a valid one (i.e. too short, not complex, etc ...)
"""
method
=
self
.
_getTypeBasedMethod
(
'analyzePassword'
)
return
method
(
password
,
**
kw
)
security
.
declareProtected
(
Permissions
.
SetOwnPassword
,
'isPasswordAlreadyUsed'
)
security
.
declareProtected
(
Permissions
.
SetOwnPassword
,
'isPasswordAlreadyUsed'
)
def
isPasswordAlreadyUsed
(
self
,
password
):
def
isPasswordAlreadyUsed
(
self
,
password
):
...
@@ -93,9 +102,13 @@ class LoginAccountProviderMixin:
...
@@ -93,9 +102,13 @@ class LoginAccountProviderMixin:
Return if password has already been used.
Return if password has already been used.
"""
"""
preferred_number_of_last_password_to_check
=
self
.
portal_preferences
.
getPreferredNumberOfLastPasswordToCheck
()
preferred_number_of_last_password_to_check
=
self
.
portal_preferences
.
getPreferredNumberOfLastPasswordToCheck
()
password_list
=
self
.
getLastChangedPasswordValueList
()
password_event_list
=
self
.
getPortalObject
().
portal_catalog
(
password_list
.
reverse
()
portal_type
=
"Password Event"
,
for
encoded_password
in
password_list
[:
preferred_number_of_last_password_to_check
]:
default_destination_uid
=
self
.
getUid
(),
sort_on
=
((
'creation_date'
,
'DESC'
,),),
limit
=
preferred_number_of_last_password_to_check
)
password_list
=
[
x
.
getPassword
()
for
x
in
password_event_list
]
for
encoded_password
in
password_list
:
if
pw_validate
(
encoded_password
,
password
):
if
pw_validate
(
encoded_password
,
password
):
return
True
return
True
return
False
return
False
product/ERP5/tests/testAuthenticationPolicy.py
View file @
7e9f03f3
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
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