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
1562d1ef
Commit
1562d1ef
authored
Apr 17, 2015
by
woogerboy21
Browse files
Merge pull request #980 from poixen/server_period
Updated server to support "."
parents
6807fed0
1f9b1d78
Changes
2
Show whitespace changes
Inline
Side-by-side
cockatrice/src/window_main.cpp
View file @
1562d1ef
...
...
@@ -78,7 +78,7 @@ void MainWindow::processConnectionClosedEvent(const Event_ConnectionClosed &even
break
;
}
case
Event_ConnectionClosed
::
SERVER_SHUTDOWN
:
reasonStr
=
tr
(
"Scheduled server shutdown."
);
break
;
case
Event_ConnectionClosed
::
USERNAMEINVALID
:
reasonStr
=
tr
(
"Invalid username.
\n
You may only use A-Z, a-z, 0-9, _, and - in your username."
);
break
;
case
Event_ConnectionClosed
::
USERNAMEINVALID
:
reasonStr
=
tr
(
"Invalid username.
\n
You may only use A-Z, a-z, 0-9, _,
.,
and - in your username."
);
break
;
default:
reasonStr
=
QString
::
fromStdString
(
event
.
reason_str
());
}
QMessageBox
::
critical
(
this
,
tr
(
"Connection closed"
),
tr
(
"The server has terminated your connection.
\n
Reason: %1"
).
arg
(
reasonStr
));
...
...
@@ -261,7 +261,7 @@ void MainWindow::loginError(Response::ResponseCode r, QString reasonStr, quint32
break
;
}
case
Response
::
RespUsernameInvalid
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Invalid username.
\n
You may only use A-Z, a-z, 0-9, _, and - in your username."
));
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"Invalid username.
\n
You may only use A-Z, a-z, 0-9, _,
.,
and - in your username."
));
break
;
case
Response
::
RespRegistrationRequired
:
QMessageBox
::
critical
(
this
,
tr
(
"Error"
),
tr
(
"This server requires user registration."
));
...
...
servatrice/src/servatrice_database_interface.cpp
View file @
1562d1ef
...
...
@@ -98,22 +98,8 @@ bool Servatrice_DatabaseInterface::execSqlQuery(QSqlQuery *query)
bool
Servatrice_DatabaseInterface
::
usernameIsValid
(
const
QString
&
user
)
{
QString
result
;
result
.
reserve
(
user
.
size
());
foreach
(
const
QChar
&
c
,
user
)
{
switch
(
c
.
category
())
{
case
QChar
::
Letter_Uppercase
:
//[A-Z]
case
QChar
::
Letter_Lowercase
:
//[a-z]
case
QChar
::
Number_DecimalDigit
:
//[0-9]
case
QChar
::
Punctuation_Connector
:
//[_]
case
QChar
::
Punctuation_Dash
:
//[-]
result
+=
c
;
default:
break
;
}
}
result
=
result
.
trimmed
();
return
(
result
.
size
()
==
user
.
size
());
static
QRegExp
re
=
QRegExp
(
"[a-zA-Z0-9_
\\
.-]+"
);
return
re
.
exactMatch
(
user
);
}
bool
Servatrice_DatabaseInterface
::
getRequireRegistration
()
...
...
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