Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
d76073cd
Commit
d76073cd
authored
Jun 22, 2015
by
Matt Lowe
Browse files
Added default values
parent
a795d7d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
servatrice/src/servatrice_database_interface.cpp
View file @
d76073cd
...
...
@@ -120,22 +120,22 @@ bool Servatrice_DatabaseInterface::execSqlQuery(QSqlQuery *query)
bool
Servatrice_DatabaseInterface
::
usernameIsValid
(
const
QString
&
user
)
{
int
maxNameLength
=
settingsCache
->
value
(
"users/maxnamelength"
).
toInt
();
int
minNameLength
=
settingsCache
->
value
(
"users/minnamelength"
).
toInt
();
int
maxNameLength
=
settingsCache
->
value
(
"users/maxnamelength"
,
12
).
toInt
();
int
minNameLength
=
settingsCache
->
value
(
"users/minnamelength"
,
6
).
toInt
();
if
(
user
.
length
()
<
minNameLength
||
user
.
length
()
>
maxNameLength
)
return
false
;
bool
allowPunctuationPrefix
=
settingsCache
->
value
(
"users/allowpunctuationprefix"
).
toBool
();
QString
allowedPunctuation
=
settingsCache
->
value
(
"users/allowedpunctuation"
).
toString
();
bool
allowPunctuationPrefix
=
settingsCache
->
value
(
"users/allowpunctuationprefix"
,
false
).
toBool
();
QString
allowedPunctuation
=
settingsCache
->
value
(
"users/allowedpunctuation"
,
"_"
).
toString
();
if
(
!
allowPunctuationPrefix
&&
allowedPunctuation
.
contains
(
user
.
at
(
0
)))
return
false
;
QString
regEx
(
"["
);
if
(
settingsCache
->
value
(
"users/allowlowercase"
).
toBool
())
if
(
settingsCache
->
value
(
"users/allowlowercase"
,
true
).
toBool
())
regEx
.
append
(
"a-z"
);
if
(
settingsCache
->
value
(
"users/allowuppercase"
).
toBool
())
if
(
settingsCache
->
value
(
"users/allowuppercase"
,
true
).
toBool
())
regEx
.
append
(
"A-Z"
);
if
(
settingsCache
->
value
(
"users/allownumerics"
).
toBool
())
if
(
settingsCache
->
value
(
"users/allownumerics"
,
true
).
toBool
())
regEx
.
append
(
"0-9"
);
regEx
.
append
(
allowedPunctuation
);
regEx
.
append
(
"]+"
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment