Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Boxiang Sun
erp5
Commits
6c0d018e
Commit
6c0d018e
authored
Jul 20, 2020
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_authentication_policy: prevent to create too much credential recovery
parent
5db51dd3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
bt5/erp5_authentication_policy/SkinTemplateItem/portal_skins/erp5_authentication_policy/Login_notifyPasswordExpire.py
.../erp5_authentication_policy/Login_notifyPasswordExpire.py
+5
-1
product/ERP5/tests/testAuthenticationPolicy.py
product/ERP5/tests/testAuthenticationPolicy.py
+6
-3
No files found.
bt5/erp5_authentication_policy/SkinTemplateItem/portal_skins/erp5_authentication_policy/Login_notifyPasswordExpire.py
View file @
6c0d018e
...
...
@@ -25,12 +25,16 @@ recovery_list = portal.portal_catalog(
limit
=
1
)
if
recovery_list
:
return
tag
=
'credential_recovery_%s'
%
context
.
getReference
()
if
portal
.
portal_activities
.
countMessageWithTag
(
tag
):
return
module
=
portal
.
getDefaultModule
(
portal_type
=
'Credential Recovery'
)
credential_recovery
=
module
.
newContent
(
portal_type
=
"Credential Recovery"
,
reference
=
username
,
destination_decision_value
=
user
,
language
=
portal
.
Localizer
.
get_selected_language
())
language
=
portal
.
Localizer
.
get_selected_language
(),
activate_kw
=
{
'tag'
:
tag
})
context
.
serialize
()
credential_recovery
.
submit
()
product/ERP5/tests/testAuthenticationPolicy.py
View file @
6c0d018e
...
...
@@ -634,13 +634,16 @@ class TestAuthenticationPolicy(ERP5TypeTestCase):
basic
=
self
.
id
()
+
':password'
,
)
# User cannot login
response
=
publish
()
self
.
assertTrue
(
response
.
getHeader
(
"Location"
).
endswith
(
"login_form"
))
# fire 5 requests, only 1 credential recovery should be created
for
i
in
range
(
5
):
response
=
publish
()
self
.
assertTrue
(
response
.
getHeader
(
"Location"
).
endswith
(
"login_form"
))
self
.
tic
()
# and a credential recovery is created automatically
credential_recovery
,
=
person
.
getDestinationDecisionRelatedValueList
(
credential_recovery
_list
=
person
.
getDestinationDecisionRelatedValueList
(
portal_type
=
'Credential Recovery'
)
self
.
assertEqual
(
len
(
credential_recovery_list
),
1
)
# trying to login again does not create a new credential recovery
response
=
publish
()
...
...
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