Webserver: -fix: Password and Roles are not saved.
This commit is contained in:
1 parent
60a8c59b7d
commit
304529f396
2 files changed
+14
-3
No files matched your search
@@ -239,7 +239,7 @@ namespace Vocaluxe.Base.Server
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
|
RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
|
||||||
byte[] buffer = new byte[128];
|
byte[] buffer = new byte[32];
|
||||||
rng.GetNonZeroBytes(buffer);
|
rng.GetNonZeroBytes(buffer);
|
||||||
byte[] salt = buffer;
|
byte[] salt = buffer;
|
||||||
byte[] hashedPassword = _Hash((new UTF8Encoding()).GetBytes(profile.Password), salt);
|
byte[] hashedPassword = _Hash((new UTF8Encoding()).GetBytes(profile.Password), salt);
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace VocaluxeLib.Profile
|
|||||||
Active = EOffOn.TR_CONFIG_ON;
|
Active = EOffOn.TR_CONFIG_ON;
|
||||||
|
|
||||||
AvatarFileName = String.Empty;
|
AvatarFileName = String.Empty;
|
||||||
FileName = String.Empty;
|
FileName = String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool LoadProfile()
|
public bool LoadProfile()
|
||||||
@@ -90,7 +90,15 @@ namespace VocaluxeLib.Profile
|
|||||||
xmlReader.GetValue("//root/Info/Avatar", out AvatarFileName, String.Empty);
|
xmlReader.GetValue("//root/Info/Avatar", out AvatarFileName, String.Empty);
|
||||||
xmlReader.TryGetEnumValue("//root/Info/GuestProfile", ref GuestProfile);
|
xmlReader.TryGetEnumValue("//root/Info/GuestProfile", ref GuestProfile);
|
||||||
xmlReader.TryGetEnumValue("//root/Info/Active", ref Active);
|
xmlReader.TryGetEnumValue("//root/Info/Active", ref Active);
|
||||||
|
string passwordHash;
|
||||||
|
xmlReader.GetValue("//root/Info/PasswordHash", out passwordHash, "");
|
||||||
|
PasswordHash = Encoding.UTF8.GetBytes(passwordHash);
|
||||||
|
string passwordSalt;
|
||||||
|
xmlReader.GetValue("//root/Info/PasswordHash", out passwordSalt, "");
|
||||||
|
PasswordSalt = Encoding.UTF8.GetBytes(passwordSalt);
|
||||||
|
string userRoles;
|
||||||
|
xmlReader.GetValue("//root/Info/UserRoles", out userRoles, "0");
|
||||||
|
Int32.TryParse(userRoles, out UserRoles);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +159,9 @@ namespace VocaluxeLib.Profile
|
|||||||
writer.WriteElementString("Avatar", Path.GetFileName(Avatar.FileName));
|
writer.WriteElementString("Avatar", Path.GetFileName(Avatar.FileName));
|
||||||
writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), GuestProfile));
|
writer.WriteElementString("GuestProfile", Enum.GetName(typeof(EOffOn), GuestProfile));
|
||||||
writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), Active));
|
writer.WriteElementString("Active", Enum.GetName(typeof(EOffOn), Active));
|
||||||
|
writer.WriteElementString("PasswordHash", Encoding.UTF8.GetString(PasswordHash));
|
||||||
|
writer.WriteElementString("PasswordSalt", Encoding.UTF8.GetString(PasswordSalt));
|
||||||
|
writer.WriteElementString("UserRoles", UserRoles.ToString());
|
||||||
writer.WriteEndElement();
|
writer.WriteEndElement();
|
||||||
|
|
||||||
writer.WriteEndElement(); //end of root
|
writer.WriteEndElement(); //end of root
|
||||||
|
|||||||
Reference in new issue
Block a user