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
68e2fb91
Commit
68e2fb91
authored
Mar 17, 2016
by
Fabio Bas
Browse files
Servatrice: Split requireemail into requireemail and requireemailactivation
parent
0b8f52e0
Changes
3
Hide whitespace changes
Inline
Side-by-side
servatrice/servatrice.ini.example
View file @
68e2fb91
...
...
@@ -105,11 +105,14 @@ allowpunctuationprefix=false
; Enable this feature? Default false.
;enabled=false
; Require users to provide an email address in order to register. Newly registered users will receive an
; activation token by email, and will be required to input back this token on cockatrice at the first login
; to get their account activated. Default true.
; Require users to provide an email address in order to register. Default true.
;requireemail=true
; Require email activation. Newly registered users will receive an activation token by email,
; and will be required to input back this token on cockatrice at the first login to get their
; account activated. Default true.
;requireemailactivation=true
[smtp]
; Connectin type: currently supported method are "tcp" and "ssl"; tls is autodetected if available
...
...
servatrice/src/servatrice.cpp
View file @
68e2fb91
...
...
@@ -175,11 +175,15 @@ bool Servatrice::initServer()
bool
registrationEnabled
=
settingsCache
->
value
(
"registration/enabled"
,
false
).
toBool
();
bool
requireEmailForRegistration
=
settingsCache
->
value
(
"registration/requireemail"
,
true
).
toBool
();
bool
requireEmailActivation
=
settingsCache
->
value
(
"registration/requireemailactivation"
,
true
).
toBool
();
qDebug
()
<<
"Accept registered users only: "
<<
regServerOnly
;
qDebug
()
<<
"Registration enabled: "
<<
registrationEnabled
;
if
(
registrationEnabled
)
{
qDebug
()
<<
"Require email address to register: "
<<
requireEmailForRegistration
;
qDebug
()
<<
"Require email activation via token: "
<<
requireEmailActivation
;
}
FeatureSet
features
;
features
.
initalizeFeatureList
(
serverRequiredFeatureList
);
...
...
@@ -498,8 +502,8 @@ void Servatrice::statusUpdate()
// send activation emails
bool
registrationEnabled
=
settingsCache
->
value
(
"registration/enabled"
,
false
).
toBool
();
bool
requireEmail
ForRegistr
ation
=
settingsCache
->
value
(
"registration/requireemail"
,
true
).
toBool
();
if
(
registrationEnabled
&&
requireEmail
ForRegistr
ation
)
bool
requireEmail
Activ
ation
=
settingsCache
->
value
(
"registration/requireemail
activation
"
,
true
).
toBool
();
if
(
registrationEnabled
&&
requireEmail
Activ
ation
)
{
QSqlQuery
*
query
=
servatriceDatabaseInterface
->
prepareQuery
(
"select a.name, b.email, b.token from {prefix}_activation_emails a left join {prefix}_users b on a.name = b.name"
);
if
(
!
servatriceDatabaseInterface
->
execSqlQuery
(
query
))
...
...
servatrice/src/serversocketinterface.cpp
View file @
68e2fb91
...
...
@@ -1034,12 +1034,13 @@ Response::ResponseCode ServerSocketInterface::cmdRegisterAccount(const Command_R
return
Response
::
RespPasswordTooShort
;
QString
token
;
bool
regSucceeded
=
sqlInterface
->
registerUser
(
userName
,
realName
,
gender
,
password
,
emailAddress
,
country
,
token
,
!
requireEmailForRegistration
);
bool
requireEmailActivation
=
settingsCache
->
value
(
"registration/requireemailactivation"
,
true
).
toBool
();
bool
regSucceeded
=
sqlInterface
->
registerUser
(
userName
,
realName
,
gender
,
password
,
emailAddress
,
country
,
token
,
!
requireEmailActivation
);
if
(
regSucceeded
)
{
qDebug
()
<<
"Accepted register command for user: "
<<
userName
;
if
(
requireEmail
ForRegistr
ation
)
if
(
requireEmail
Activ
ation
)
{
QSqlQuery
*
query
=
sqlInterface
->
prepareQuery
(
"insert into {prefix}_activation_emails (name) values(:name)"
);
query
->
bindValue
(
":name"
,
userName
);
...
...
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