Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
docker
osticket
Commits
770fe4e0
Commit
770fe4e0
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Plain Diff
Merge branch 'develop' into develop-next
parents
9efd196f
6986e6f7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
include/class.validator.php
+1
-1
1 addition, 1 deletion
include/class.validator.php
setup/test/tests/test.validation.php
+21
-0
21 additions, 0 deletions
setup/test/tests/test.validation.php
with
22 additions
and
1 deletion
include/class.validator.php
+
1
−
1
View file @
770fe4e0
...
...
@@ -177,7 +177,7 @@ class Validator {
function
is_username
(
$username
,
&
$error
=
''
)
{
if
(
strlen
(
$username
)
<
2
)
$error
=
'At least two (2) characters'
;
elseif
(
!
preg_match
(
'/^[\p{L}._-]+$/u'
,
$username
))
elseif
(
!
preg_match
(
'/^[\p{L}
\d
._-]+$/u'
,
$username
))
$error
=
'Username contains invalid characters'
;
return
$error
==
''
;
}
...
...
This diff is collapsed.
Click to expand it.
setup/test/tests/test.validation.php
0 → 100644
+
21
−
0
View file @
770fe4e0
<?php
require_once
INCLUDE_DIR
.
'class.validator.php'
;
class
TestValidation
extends
Test
{
var
$name
=
"Validation checks"
;
function
testValidUsernames
()
{
// Ascii
$this
->
assert
(
Validator
::
is_username
(
'jared'
));
$this
->
assert
(
Validator
::
is_username
(
'jared12'
));
// Unicode
$this
->
assert
(
Validator
::
is_username
(
'järed'
));
$this
->
assert
(
Validator
::
is_username
(
'järed12'
));
$this
->
assert
(
Validator
::
is_username
(
'中国期刊全文数据'
));
// Non-letters
$this
->
assert
(
!
Validator
::
is_username
(
'j®red'
));
}
}
return
'TestValidation'
;
?>
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