Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
02e52f81
Commit
02e52f81
authored
Jan 07, 2011
by
rojanu
Committed by
Frédéric Buclin
Jan 07, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 558803: Add a parameter to specify the password complexity for new passwords
r/a=LpSolit
parent
0e7d52ed
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
1 deletion
+52
-1
Auth.pm
Bugzilla/Config/Auth.pm
+9
-0
User.pm
Bugzilla/User.pm
+13
-0
auth.html.tmpl
template/en/default/admin/params/auth.html.tmpl
+13
-1
user-error.html.tmpl
template/en/default/global/user-error.html.tmpl
+17
-0
No files found.
Bugzilla/Config/Auth.pm
View file @
02e52f81
...
...
@@ -121,6 +121,15 @@ sub get_param_list {
type
=>
't'
,
default
=>
q:.*:
,
checker
=>
\&
check_regexp
},
{
name
=>
'password_complexity'
,
type
=>
's'
,
choices
=>
[
'no_constraints'
,
'mixed_letters'
,
'letters_numbers'
,
'letters_numbers_specialchars'
],
default
=>
'no_constraints'
,
checker
=>
\&
check_multi
}
);
return
@param_list
;
}
...
...
Bugzilla/User.pm
View file @
02e52f81
...
...
@@ -1946,6 +1946,19 @@ sub validate_password {
}
elsif
((
defined
$matchpassword
)
&&
(
$password
ne
$matchpassword
))
{
ThrowUserError
(
'passwords_dont_match'
);
}
my
$complexity_level
=
Bugzilla
->
params
->
{
password_complexity
};
if
(
$complexity_level
eq
'letters_numbers_specialchars'
)
{
ThrowUserError
(
'password_not_complex'
)
if
(
$password
!~
/\w/
||
$password
!~
/\d/
||
$password
!~
/[[:punct:]]/
);
}
elsif
(
$complexity_level
eq
'letters_numbers'
)
{
ThrowUserError
(
'password_not_complex'
)
if
(
$password
!~
/[[:lower:]]/
||
$password
!~
/[[:upper:]]/
||
$password
!~
/\d/
);
}
elsif
(
$complexity_level
eq
'mixed_letters'
)
{
ThrowUserError
(
'password_not_complex'
)
if
(
$password
!~
/[[:lower:]]/
||
$password
!~
/[[:upper:]]/
);
}
# Having done these checks makes us consider the password untainted.
trick_taint
(
$_
[
0
]);
return
1
;
...
...
template/en/default/admin/params/auth.html.tmpl
View file @
02e52f81
...
...
@@ -125,5 +125,17 @@
"default (.*) permits any account matching the emailregexp " _
"to be created. If this parameter is left blank, no users " _
"will be permitted to create their own accounts and all accounts " _
"will have to be created by an administrator." }
"will have to be created by an administrator.",
password_complexity =>
"Set the complexity required for passwords. In all cases must the passwords " _
"be at least ${constants.USER_PASSWORD_MIN_LENGTH} characters long." _
"<ul><li>no_constraints - No complexity required.</li>" _
"<li>mixed_letters - Passwords must contain at least one UPPER and one lower " _
"case letter.</li>" _
"<li>letters_numbers - Passwords must contain at least one UPPER and one " _
"lower case letter and a number.</li>" _
"<li>letters_numbers_specialchars - Passwords must contain at least one " _
"UPPER or one lower case letter, a number and a special character.</li></ul>"
}
%]
template/en/default/global/user-error.html.tmpl
View file @
02e52f81
...
...
@@ -1325,6 +1325,23 @@
The password must be at least
[%+ constants.USER_PASSWORD_MIN_LENGTH FILTER html %] characters long.
[% ELSIF error == "password_not_complex" %]
[% title = "Password Fails Requirements" %]
[% passregex = Param('password_complexity') %]
The password must contain at least one:
<ul>
[% IF passregex.search('letters') %]
<li>UPPERCASE letter</li>
<li>lowercase letter</li>
[% END %]
[% IF passregex.search('numbers') %]
<li>digit</li>
[% END %]
[% IF passregex.search('specialchars') %]
<li>special character</li>
[% END %]
</ul>
[% ELSIF error == "product_access_denied" %]
[% title = "Product Access Denied" %]
Either the product
...
...
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