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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Nicolas Wavrant
erp5
Commits
f56572ef
Commit
f56572ef
authored
Jan 22, 2021
by
Nicolas Wavrant
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_core: fix variables in formatted strings
parent
97e63f46
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
3 deletions
+35
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPasswordTool.py
...plateItem/portal_components/test.erp5.testPasswordTool.py
+26
-0
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.PasswordTool.py
...tTemplateItem/portal_components/tool.erp5.PasswordTool.py
+9
-3
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPasswordTool.py
View file @
f56572ef
...
...
@@ -434,6 +434,32 @@ class TestPasswordTool(ERP5TypeTestCase):
# But no mail has been sent
self
.
stepCheckNoMailSent
()
def
test_unreachable_email_on_person
(
self
):
person
=
self
.
portal
.
person_module
.
newContent
(
portal_type
=
"Person"
,
reference
=
"user"
,
default_email_text
=
"user@example.invalid"
,
)
person
.
getDefaultEmailValue
().
declareUnreachable
()
assignment
=
person
.
newContent
(
portal_type
=
'Assignment'
)
assignment
.
open
()
login
=
person
.
newContent
(
portal_type
=
'ERP5 Login'
,
reference
=
'user-login'
,
password
=
'password'
,
)
login
.
validate
()
self
.
tic
()
self
.
logout
()
ret
=
self
.
portal
.
portal_password
.
mailPasswordResetRequest
(
user_login
=
'user-login'
,
REQUEST
=
self
.
portal
.
REQUEST
)
# For security reasons, the message should always be the same
self
.
assertTrue
(
"portal_status_message=An+email+has+been+sent+to+you."
in
str
(
ret
))
# But no mail has been sent
self
.
stepCheckNoMailSent
()
def
test_acquired_email_on_person
(
self
):
organisation
=
self
.
portal
.
organisation_module
.
newContent
(
portal_type
=
'Organisation'
,
...
...
product/ERP5/bootstrap/erp5_core/ToolComponentTemplateItem/portal_components/tool.erp5.PasswordTool.py
View file @
f56572ef
...
...
@@ -161,7 +161,7 @@ class PasswordTool(BaseTool):
error_encountered
=
True
LOG
(
'ERP5.PasswordTool'
,
INFO
,
"User
$
{user} does not exist."
.
format
(
user
=
user_login
)
"User {user} does not exist."
.
format
(
user
=
user_login
)
)
else
:
# We use checked_permission to prevent errors when trying to acquire
...
...
@@ -174,13 +174,19 @@ class PasswordTool(BaseTool):
if
email_value
is
None
or
not
email_value
.
asText
():
if
credential_request_exists
:
raise
RuntimeError
(
"User
$
{user} does not have an email address, "
"User {user} does not have an email address, "
"please contact site administrator directly"
.
format
(
user
=
user_login
)
)
error_encountered
=
True
LOG
(
'ERP5.PasswordTool'
,
INFO
,
"User ${user} does not have an email address"
.
format
(
user
=
user_login
)
"User {user} does not have an email address"
.
format
(
user
=
user_login
)
)
elif
email_value
.
getValidationState
()
!=
"reachable"
:
error_encountered
=
True
LOG
(
'ERP5.PasswordTool'
,
INFO
,
"User {user} does not have a valid email address"
.
format
(
user
=
user_login
)
)
if
error_encountered
:
if
batch
:
...
...
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