Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal
Commits
0d510d72
Commit
0d510d72
authored
10 years ago
by
Alex Pott
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#2321167
by emma.maria, tompagabor | LewisNyman: Move password indicator colours into CSS.
parent
c69e1ab0
Loading
Loading
2 merge requests
!7452
Issue #1797438. HTML5 validation is preventing form submit and not fully...
,
!789
Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
core/modules/user/css/user.module.css
+12
-1
12 additions, 1 deletion
core/modules/user/css/user.module.css
core/modules/user/user.js
+8
-7
8 additions, 7 deletions
core/modules/user/user.js
with
20 additions
and
8 deletions
core/modules/user/css/user.module.css
+
12
−
1
View file @
0d510d72
...
...
@@ -64,4 +64,15 @@ div.password-suggestions ul {
[
dir
=
"rtl"
]
.password-parent
{
clear
:
right
;
}
.password-strength__indicator.is-weak
{
background-color
:
#e62600
;
}
.password-strength__indicator.is-fair
{
background-color
:
#e09600
;
}
.password-strength__indicator.is-good
{
background-color
:
#0074bd
;
}
.password-strength__indicator.is-strong
{
background-color
:
#77b259
;
}
This diff is collapsed.
Click to expand it.
core/modules/user/user.js
+
8
−
7
View file @
0d510d72
...
...
@@ -58,7 +58,8 @@
// Adjust the length of the strength indicator.
innerWrapper
.
find
(
'
.password-strength__indicator
'
)
.
css
(
'
width
'
,
result
.
strength
+
'
%
'
)
.
css
(
'
background-color
'
,
result
.
indicatorColor
);
.
removeClass
(
'
is-weak is-fair is-good is-strong
'
)
.
addClass
(
result
.
indicatorClass
);
// Update the strength indication text.
innerWrapper
.
find
(
'
.password-strength__text
'
).
html
(
result
.
indicatorText
);
...
...
@@ -87,7 +88,7 @@
* Returns the estimated strength and the relevant output message.
*/
Drupal
.
evaluatePasswordStrength
=
function
(
password
,
translate
)
{
var
indicatorText
,
indicatorC
olor
,
weaknesses
=
0
,
strength
=
100
,
msg
=
[];
var
indicatorText
,
indicatorC
lass
,
weaknesses
=
0
,
strength
=
100
,
msg
=
[];
var
hasLowercase
=
/
[
a-z
]
+/
.
test
(
password
);
var
hasUppercase
=
/
[
A-Z
]
+/
.
test
(
password
);
...
...
@@ -152,24 +153,24 @@
// Based on the strength, work out what text should be shown by the password strength meter.
if
(
strength
<
60
)
{
indicatorText
=
translate
.
weak
;
indicatorC
olor
=
'
#e62600
'
;
indicatorC
lass
=
'
is-weak
'
;
}
else
if
(
strength
<
70
)
{
indicatorText
=
translate
.
fair
;
indicatorC
olor
=
'
#e09600
'
;
indicatorC
lass
=
'
is-fair
'
;
}
else
if
(
strength
<
80
)
{
indicatorText
=
translate
.
good
;
indicatorC
olor
=
'
#0074b
d
'
;
indicatorC
lass
=
'
is-goo
d
'
;
}
else
if
(
strength
<=
100
)
{
indicatorText
=
translate
.
strong
;
indicatorC
olor
=
'
#77b259
'
;
indicatorC
lass
=
'
is-strong
'
;
}
// Assemble the final message.
msg
=
translate
.
hasWeaknesses
+
'
<ul><li>
'
+
msg
.
join
(
'
</li><li>
'
)
+
'
</li></ul>
'
;
return
{
strength
:
strength
,
message
:
msg
,
indicatorText
:
indicatorText
,
indicatorC
olor
:
indicatorC
olor
};
return
{
strength
:
strength
,
message
:
msg
,
indicatorText
:
indicatorText
,
indicatorC
lass
:
indicatorC
lass
};
};
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment