implement email field for MySQL and SQLite
From: Sean Dague <sdague@gmail.com>0.6.0-stable
parent
6e14d1005a
commit
702249358b
|
@ -540,6 +540,7 @@ namespace OpenSim.Data.MySQL
|
||||||
retval.ID = id;
|
retval.ID = id;
|
||||||
retval.FirstName = (string) reader["username"];
|
retval.FirstName = (string) reader["username"];
|
||||||
retval.SurName = (string) reader["lastname"];
|
retval.SurName = (string) reader["lastname"];
|
||||||
|
retval.Email = (string) reader["email"];
|
||||||
|
|
||||||
retval.PasswordHash = (string) reader["passwordHash"];
|
retval.PasswordHash = (string) reader["passwordHash"];
|
||||||
retval.PasswordSalt = (string) reader["passwordSalt"];
|
retval.PasswordSalt = (string) reader["passwordSalt"];
|
||||||
|
@ -768,7 +769,7 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <param name="firstImage">UUID for firstlife image</param>
|
/// <param name="firstImage">UUID for firstlife image</param>
|
||||||
/// <param name="webLoginKey">Ignored</param>
|
/// <param name="webLoginKey">Ignored</param>
|
||||||
/// <returns>Success?</returns>
|
/// <returns>Success?</returns>
|
||||||
public bool insertUserRow(UUID uuid, string username, string lastname, string passwordHash,
|
public bool insertUserRow(UUID uuid, string username, string lastname, string email, string passwordHash,
|
||||||
string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
|
string passwordSalt, UInt64 homeRegion, float homeLocX, float homeLocY, float homeLocZ,
|
||||||
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
||||||
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
||||||
|
@ -777,14 +778,14 @@ namespace OpenSim.Data.MySQL
|
||||||
{
|
{
|
||||||
m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString());
|
m_log.Debug("[MySQLManager]: Fetching profile for " + uuid.ToString());
|
||||||
string sql =
|
string sql =
|
||||||
"INSERT INTO users (`UUID`, `username`, `lastname`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
|
"INSERT INTO users (`UUID`, `username`, `lastname`, `email`, `passwordHash`, `passwordSalt`, `homeRegion`, ";
|
||||||
sql +=
|
sql +=
|
||||||
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
|
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
|
||||||
sql +=
|
sql +=
|
||||||
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
|
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
|
||||||
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES ";
|
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`, `customType`, `partner`) VALUES ";
|
||||||
|
|
||||||
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
|
sql += "(?UUID, ?username, ?lastname, ?email, ?passwordHash, ?passwordSalt, ?homeRegion, ";
|
||||||
sql +=
|
sql +=
|
||||||
"?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
|
"?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
|
||||||
sql +=
|
sql +=
|
||||||
|
@ -793,10 +794,11 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
parameters["?UUID"] = uuid.ToString();
|
parameters["?UUID"] = uuid.ToString();
|
||||||
parameters["?username"] = username.ToString();
|
parameters["?username"] = username;
|
||||||
parameters["?lastname"] = lastname.ToString();
|
parameters["?lastname"] = lastname;
|
||||||
parameters["?passwordHash"] = passwordHash.ToString();
|
parameters["?email"] = email;
|
||||||
parameters["?passwordSalt"] = passwordSalt.ToString();
|
parameters["?passwordHash"] = passwordHash;
|
||||||
|
parameters["?passwordSalt"] = passwordSalt;
|
||||||
parameters["?homeRegion"] = homeRegion.ToString();
|
parameters["?homeRegion"] = homeRegion.ToString();
|
||||||
parameters["?homeLocationX"] = homeLocX.ToString();
|
parameters["?homeLocationX"] = homeLocX.ToString();
|
||||||
parameters["?homeLocationY"] = homeLocY.ToString();
|
parameters["?homeLocationY"] = homeLocY.ToString();
|
||||||
|
@ -869,14 +871,14 @@ namespace OpenSim.Data.MySQL
|
||||||
/// <param name="firstImage">UUID for firstlife image</param>
|
/// <param name="firstImage">UUID for firstlife image</param>
|
||||||
/// <param name="webLoginKey">UUID for weblogin Key</param>
|
/// <param name="webLoginKey">UUID for weblogin Key</param>
|
||||||
/// <returns>Success?</returns>
|
/// <returns>Success?</returns>
|
||||||
public bool updateUserRow(UUID uuid, string username, string lastname, string passwordHash,
|
public bool updateUserRow(UUID uuid, string username, string lastname, string email, string passwordHash,
|
||||||
string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ,
|
string passwordSalt, UInt64 homeRegion, UUID homeRegionID, float homeLocX, float homeLocY, float homeLocZ,
|
||||||
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
|
||||||
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
|
||||||
string aboutText, string firstText,
|
string aboutText, string firstText,
|
||||||
UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner)
|
UUID profileImage, UUID firstImage, UUID webLoginKey, int userFlags, int godLevel, string customType, UUID partner)
|
||||||
{
|
{
|
||||||
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
|
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname, `email` = ?email ";
|
||||||
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
|
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
|
||||||
sql += "`homeRegion` = ?homeRegion , `homeRegionID` = ?homeRegionID, `homeLocationX` = ?homeLocationX , ";
|
sql += "`homeRegion` = ?homeRegion , `homeRegionID` = ?homeRegionID, `homeLocationX` = ?homeLocationX , ";
|
||||||
sql += "`homeLocationY` = ?homeLocationY , `homeLocationZ` = ?homeLocationZ , ";
|
sql += "`homeLocationY` = ?homeLocationY , `homeLocationZ` = ?homeLocationZ , ";
|
||||||
|
@ -892,10 +894,11 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
Dictionary<string, string> parameters = new Dictionary<string, string>();
|
||||||
parameters["?UUID"] = uuid.ToString();
|
parameters["?UUID"] = uuid.ToString();
|
||||||
parameters["?username"] = username.ToString();
|
parameters["?username"] = username;
|
||||||
parameters["?lastname"] = lastname.ToString();
|
parameters["?lastname"] = lastname;
|
||||||
parameters["?passwordHash"] = passwordHash.ToString();
|
parameters["?email"] = email;
|
||||||
parameters["?passwordSalt"] = passwordSalt.ToString();
|
parameters["?passwordHash"] = passwordHash;
|
||||||
|
parameters["?passwordSalt"] = passwordSalt;
|
||||||
parameters["?homeRegion"] = homeRegion.ToString();
|
parameters["?homeRegion"] = homeRegion.ToString();
|
||||||
parameters["?homeRegionID"] = homeRegionID.ToString();
|
parameters["?homeRegionID"] = homeRegionID.ToString();
|
||||||
parameters["?homeLocationX"] = homeLocX.ToString();
|
parameters["?homeLocationX"] = homeLocX.ToString();
|
||||||
|
|
|
@ -642,7 +642,7 @@ namespace OpenSim.Data.MySQL
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt,
|
dbm.Manager.insertUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
|
||||||
user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y,
|
user.HomeRegion, user.HomeLocation.X, user.HomeLocation.Y,
|
||||||
user.HomeLocation.Z,
|
user.HomeLocation.Z,
|
||||||
user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created,
|
user.HomeLookAt.X, user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created,
|
||||||
|
@ -697,7 +697,7 @@ namespace OpenSim.Data.MySQL
|
||||||
MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile");
|
MySQLSuperManager dbm = GetLockedConnection("UpdateUserProfile");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.PasswordHash, user.PasswordSalt,
|
dbm.Manager.updateUserRow(user.ID, user.FirstName, user.SurName, user.Email, user.PasswordHash, user.PasswordSalt,
|
||||||
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
|
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y,
|
||||||
user.HomeLocation.Z, user.HomeLookAt.X,
|
user.HomeLocation.Z, user.HomeLookAt.X,
|
||||||
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin,
|
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin,
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE users add email varchar(250);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -0,0 +1,5 @@
|
||||||
|
BEGIN TRANSACTION;
|
||||||
|
|
||||||
|
ALTER TABLE users add email varchar(250);
|
||||||
|
|
||||||
|
COMMIT;
|
|
@ -710,6 +710,7 @@ namespace OpenSim.Data.SQLite
|
||||||
SQLiteUtil.createCol(users, "UUID", typeof (String));
|
SQLiteUtil.createCol(users, "UUID", typeof (String));
|
||||||
SQLiteUtil.createCol(users, "username", typeof (String));
|
SQLiteUtil.createCol(users, "username", typeof (String));
|
||||||
SQLiteUtil.createCol(users, "surname", typeof (String));
|
SQLiteUtil.createCol(users, "surname", typeof (String));
|
||||||
|
SQLiteUtil.createCol(users, "email", typeof (String));
|
||||||
SQLiteUtil.createCol(users, "passwordHash", typeof (String));
|
SQLiteUtil.createCol(users, "passwordHash", typeof (String));
|
||||||
SQLiteUtil.createCol(users, "passwordSalt", typeof (String));
|
SQLiteUtil.createCol(users, "passwordSalt", typeof (String));
|
||||||
|
|
||||||
|
@ -812,6 +813,7 @@ namespace OpenSim.Data.SQLite
|
||||||
user.ID = tmp;
|
user.ID = tmp;
|
||||||
user.FirstName = (String) row["username"];
|
user.FirstName = (String) row["username"];
|
||||||
user.SurName = (String) row["surname"];
|
user.SurName = (String) row["surname"];
|
||||||
|
user.Email = (String) row["email"];
|
||||||
user.PasswordHash = (String) row["passwordHash"];
|
user.PasswordHash = (String) row["passwordHash"];
|
||||||
user.PasswordSalt = (String) row["passwordSalt"];
|
user.PasswordSalt = (String) row["passwordSalt"];
|
||||||
|
|
||||||
|
@ -864,6 +866,7 @@ namespace OpenSim.Data.SQLite
|
||||||
row["UUID"] = Util.ToRawUuidString(user.ID);
|
row["UUID"] = Util.ToRawUuidString(user.ID);
|
||||||
row["username"] = user.FirstName;
|
row["username"] = user.FirstName;
|
||||||
row["surname"] = user.SurName;
|
row["surname"] = user.SurName;
|
||||||
|
row["email"] = user.Email;
|
||||||
row["passwordHash"] = user.PasswordHash;
|
row["passwordHash"] = user.PasswordHash;
|
||||||
row["passwordSalt"] = user.PasswordSalt;
|
row["passwordSalt"] = user.PasswordSalt;
|
||||||
|
|
||||||
|
|
|
@ -135,6 +135,9 @@ namespace OpenSim.Data.Tests
|
||||||
Assert.That(user1,Is.EqualTo(u1a.ID));
|
Assert.That(user1,Is.EqualTo(u1a.ID));
|
||||||
Assert.That(user2,Is.EqualTo(u2a.ID));
|
Assert.That(user2,Is.EqualTo(u2a.ID));
|
||||||
Assert.That(user3,Is.EqualTo(u3a.ID));
|
Assert.That(user3,Is.EqualTo(u3a.ID));
|
||||||
|
|
||||||
|
// and one email test
|
||||||
|
Assert.That(u1.Email, Is.EqualTo(u1a.Email));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -297,6 +300,7 @@ namespace OpenSim.Data.Tests
|
||||||
u.SurName = lname;
|
u.SurName = lname;
|
||||||
u.PasswordHash = "NOTAHASH";
|
u.PasswordHash = "NOTAHASH";
|
||||||
u.PasswordSalt = "NOTSALT";
|
u.PasswordSalt = "NOTSALT";
|
||||||
|
u.Email = "nobody@nodomain.nocc";
|
||||||
// MUST specify at least these 5 parameters or an exception is raised
|
// MUST specify at least these 5 parameters or an exception is raised
|
||||||
|
|
||||||
return u;
|
return u;
|
||||||
|
|
|
@ -124,7 +124,7 @@ namespace OpenSim.Framework
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A valid email address for the account. Useful for password reset requests.
|
/// A valid email address for the account. Useful for password reset requests.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private string _email;
|
private string _email = String.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A URI to the users asset server, used for foreigners and large grids.
|
/// A URI to the users asset server, used for foreigners and large grids.
|
||||||
|
|
Loading…
Reference in New Issue