diff options
author | gerv%gerv.net <> | 2002-10-06 20:52:28 +0200 |
---|---|---|
committer | gerv%gerv.net <> | 2002-10-06 20:52:28 +0200 |
commit | b8851cdd5c15e0d21543d9fe08159b9ced8c950f (patch) | |
tree | ce1c674c28c6491d3a86e3afb182963737666e2d /globals.pl | |
parent | f50efb95e1c7462699f1179d0a62b1ee7118e67e (diff) | |
download | bugzilla-b8851cdd5c15e0d21543d9fe08159b9ced8c950f.tar.gz bugzilla-b8851cdd5c15e0d21543d9fe08159b9ced8c950f.tar.xz |
Bug 163114 - Templatise all calls to DisplayError. Patch D (the last one). Patch by gerv; r=burnus.
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/globals.pl b/globals.pl index 605549315..f1e8f0d74 100644 --- a/globals.pl +++ b/globals.pl @@ -680,24 +680,18 @@ sub CanSeeBug { sub ValidatePassword { # Determines whether or not a password is valid (i.e. meets Bugzilla's - # requirements for length and content). If the password is valid, the - # function returns boolean false. Otherwise it returns an error message - # (synonymous with boolean true) that can be displayed to the user. - + # requirements for length and content). # If a second password is passed in, this function also verifies that # the two passwords match. - my ($password, $matchpassword) = @_; - if ( length($password) < 3 ) { - return "The password is less than three characters long. It must be at least three characters."; - } elsif ( length($password) > 16 ) { - return "The password is more than 16 characters long. It must be no more than 16 characters."; - } elsif ( $matchpassword && $password ne $matchpassword ) { - return "The two passwords do not match."; + if (length($password) < 3) { + ThrowUserError("password_too_short"); + } elsif (length($password) > 16) { + ThrowUserError("password_too_long"); + } elsif ($matchpassword && $password ne $matchpassword) { + ThrowUserError("passwords_dont_match"); } - - return 0; } |