public virtual bool SetPassword(UUID principalID, string authType, string password) { string passwordSalt = Util.Md5Hash(UUID.Random().ToString()); string md5PasswdHash = Util.Md5Hash(Util.Md5Hash(password) + ":" + passwordSalt); AuthData auth = m_Database.Get(principalID, authType); if (auth == null) { auth = new AuthData {PrincipalID = principalID, AccountType = authType}; } auth.PasswordHash = md5PasswdHash; auth.PasswordSalt = passwordSalt; if (!m_Database.Store(auth)) { MainConsole.Instance.DebugFormat("[AUTHENTICATION DB]: Failed to store authentication data"); return false; } MainConsole.Instance.InfoFormat("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); return true; }
public virtual bool SetPlainPassword (UUID principalID, string authType, string pass) { AuthData auth = m_Database.Get (principalID, authType); if (auth == null) { auth = new AuthData (); auth.PrincipalID = principalID; auth.AccountType = authType; } auth.PasswordHash = pass; auth.PasswordSalt = ""; if (!m_Database.Store (auth)) { m_log.DebugFormat ("[AUTHENTICATION DB]: Failed to store authentication data"); return false; } m_log.InfoFormat ("[AUTHENTICATION DB]: Set password for principalID {0}", principalID); return true; }