Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
仰若水
frappe
Commits
f1dc09fa
Commit
f1dc09fa
authored
7 years ago
by
Nabin Hait
Browse files
Options
Download
Plain Diff
Merge branch 'hotfix'
parents
1b10107b
b23d2527
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
frappe/__init__.py
+1
-1
frappe/__init__.py
frappe/core/doctype/user/test_user.py
+10
-6
frappe/core/doctype/user/test_user.py
frappe/core/doctype/user/user.py
+3
-3
frappe/core/doctype/user/user.py
frappe/www/update-password.html
+4
-8
frappe/www/update-password.html
with
18 additions
and
18 deletions
+18
-18
frappe/__init__.py
View file @
f1dc09fa
...
...
@@ -13,7 +13,7 @@ import os, sys, importlib, inspect, json
from
.exceptions
import
*
from
.utils.jinja
import
get_jenv
,
get_template
,
render_template
__version__
=
'8.0.6
3
'
__version__
=
'8.0.6
4
'
__title__
=
"Frappe Framework"
local
=
Local
()
...
...
This diff is collapsed.
Click to expand it.
frappe/core/doctype/user/test_user.py
View file @
f1dc09fa
...
...
@@ -220,22 +220,26 @@ class TestUser(unittest.TestCase):
clear_limit
(
'users'
)
def
test_password_strength
(
self
):
#Test Password without Password Strenth Policy
#
Test Password without Password Strenth Policy
frappe
.
db
.
set_value
(
"System Settings"
,
"System Settings"
,
"enable_password_policy"
,
0
)
frappe
.
db
.
set_value
(
"System Settings"
,
"System Settings"
,
"minimum_password_score"
,
""
)
# S
hould pass password strength test
# S
core 0; should fail
result
=
test_password_strength
(
"test_password"
)
self
.
assertEqual
(
result
[
'feedback'
][
'password_policy_validation_passed'
],
False
)
# Score 1; should pass
result
=
test_password_strength
(
"bee2ve"
)
self
.
assertEqual
(
result
[
'feedback'
][
'password_policy_validation_passed'
],
True
)
# Test Password with Password Strenth Policy Set
frappe
.
db
.
set_value
(
"System Settings"
,
"System Settings"
,
"enable_password_policy"
,
1
)
frappe
.
db
.
set_value
(
"System Settings"
,
"System Settings"
,
"minimum_password_score"
,
2
)
#
Should fail password strength test
result
=
test_password_strength
(
"
test_password
"
)
#
Score 1; should now fail
result
=
test_password_strength
(
"
bee2ve
"
)
self
.
assertEqual
(
result
[
'feedback'
][
'password_policy_validation_passed'
],
False
)
# Should pass
password strength test
# S
core 4; s
hould pass
result
=
test_password_strength
(
"Eastern_43A1W"
)
self
.
assertEqual
(
result
[
'feedback'
][
'password_policy_validation_passed'
],
True
)
\ No newline at end of file
self
.
assertEqual
(
result
[
'feedback'
][
'password_policy_validation_passed'
],
True
)
This diff is collapsed.
Click to expand it.
frappe/core/doctype/user/user.py
View file @
f1dc09fa
...
...
@@ -545,9 +545,9 @@ def test_password_strength(new_password, key=None, old_password=None, user_data=
enable_password_policy
=
cint
(
frappe
.
db
.
get_single_value
(
"System Settings"
,
"enable_password_policy"
))
and
True
or
False
minimum_password_score
=
cint
(
frappe
.
db
.
get_single_value
(
"System Settings"
,
"minimum_password_score"
))
or
0
password_policy_validation_passed
=
Tru
e
if
enable_password_policy
and
result
[
'score'
]
<
minimum_password_score
:
password_policy_validation_passed
=
Fals
e
password_policy_validation_passed
=
Fals
e
if
result
[
'score'
]
>
minimum_password_score
:
password_policy_validation_passed
=
Tru
e
result
[
'feedback'
][
'password_policy_validation_passed'
]
=
password_policy_validation_passed
...
...
This diff is collapsed.
Click to expand it.
frappe/www/update-password.html
View file @
f1dc09fa
...
...
@@ -148,28 +148,24 @@ frappe.ready(function() {
var
message
=
[];
feedback
.
help_msg
=
""
;
if
(
!
feedback
.
password_policy_validation_passed
){
feedback
.
help_msg
=
__
(
"
Hint: Include symbols, numbers and capital letters in the password
"
);
feedback
.
help_msg
=
"
<br>
"
+
__
(
"
Hint: Include symbols, numbers and capital letters in the password
"
);
}
if
(
feedback
)
{
if
(
!
feedback
.
password_policy_validation_passed
){
if
(
feedback
.
suggestions
&&
feedback
.
suggestions
.
length
)
{
feedback
.
suggestions
=
feedback
.
suggestions
+
'
'
+
feedback
.
help_msg
;
message
=
message
.
concat
(
feedback
.
suggestions
);
}
else
if
(
feedback
.
warning
)
{
feedback
.
warning
=
feedback
.
warning
+
'
'
+
feedback
.
help_msg
;
message
.
push
(
feedback
.
warning
);
}
message
.
push
(
feedback
.
help_msg
);
if
(
!
message
.
length
)
{
message
.
push
(
feedback
.
help_msg
);
}
}
else
{
}
else
{
message
.
push
(
__
(
'
Success! You are good to go 👍
'
));
}
}
strength_indicator
.
removeClass
().
addClass
(
'
password-strength-indicator indicator
'
+
color
);
strength_message
.
text
(
message
.
join
(
'
'
)
||
''
).
removeClass
(
'
hidden
'
);
strength_message
.
html
(
message
.
join
(
'
'
)
||
''
).
removeClass
(
'
hidden
'
);
// strength_indicator.attr('title', message.join(' ') || '');
}
...
...
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
Menu
Projects
Groups
Snippets
Help