Author: baufo
Date: Mon Mar 24 10:44:47 2008
New Revision: 25054
URL: http://svn.gna.org/viewcvs/wesnoth?rev=25054&view=rev
Log:
Fixing bug that allowed duplicate email addresses
Modified:
branches/mp_registration/src/server/user_handler.cpp
Modified: branches/mp_registration/src/server/user_handler.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/branches/mp_registration/src/server/user_handler.cpp?rev=25054&r1=25053&r2=25054&view=diff
==============================================================================
--- branches/mp_registration/src/server/user_handler.cpp (original)
+++ branches/mp_registration/src/server/user_handler.cpp Mon Mar 24 10:44:47
2008
@@ -217,15 +217,6 @@
throw error("Could not add new user. A user with the name '" + name +
"' already exists.");
}
- //Check if the given email is not yet registered
- if(!mail.empty()) {
- for(std::map<std::string,std::string*>::const_iterator i =
users_.begin(); i != users_.end(); ++i) {
- if(i->second[uh::EMAIL] == mail) {
- throw error("Could not add new user. The email address '" +
mail + "' is already in use.");
- }
- }
- }
-
std::string now = lexical_cast_default<std::string>(time(NULL));
sql_query(std::string(sqlite3_mprintf(
@@ -378,6 +369,17 @@
if(!(mail.empty() ||utils::isvalid_email(mail))) {
throw error("The email adress '" + mail + "' appears to be invalid.");
}
+
+ //Check if the given email is not yet registered
+ if(!mail.empty()) {
+ for(std::map<std::string,std::string*>::const_iterator i =
users_.begin(); i != users_.end(); ++i) {
+
+ if(i->second[uh::EMAIL] == mail) {
+ throw error("The email address '" + mail + "' is already in
use.");
+ }
+ }
+ }
+
}
void user_handler::sql_query(const std::string query,
std::vector<std::string>* data) {
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits