Пример #1
0
        public bool LinkUserAccountToUniverseAccount(Guid universeId, Int64 playerId, string playerName)
        {
            Guid userId = AuthenticateClient("LinkUserAccountToUniverseAccount");

            try
            {
                return(WebServiceDAL.LinkUserToUniverseAccount(userId, universeId, playerId, playerName, "DO_NOT_UPDATE_PASSWORD"));
            }
            catch (Exception ex)
            {
                // Log it
                WebServiceDAL.StoreException("Webservice", "LinkUserAccountToUniverseAccount", ex);
                return(false);
            }
        }
Пример #2
0
        public bool SynchronizeCredentials(Guid universeId, Int64 playerId, string playerName, string password)
        {
            Guid userId = AuthenticateClient("SynchronizeCredentials");

            try
            {
                if (string.IsNullOrEmpty(password))
                {
                    return(WebServiceDAL.LinkUserToUniverseAccount(userId, universeId, playerId, playerName, password));
                }
                else
                {
                    Int64 encryptionKeyId = WebServiceDAL.GetUserEncryptionKeyId(userId);
                    if (encryptionKeyId != 0)
                    {
                        DataTable encryptionKeys = WebServiceDAL.GetUserEncryptionKeys(encryptionKeyId);

                        string serverKey = Encryption.DecryptString(UtilitiesBLL.DecryptEncryptionKeyHash(encryptionKeys.Rows[0]["ServerKey"].ToString()), Credentials.Password);
                        string clientKey = Encryption.DecryptString(UtilitiesBLL.DecryptEncryptionKeyHash(encryptionKeys.Rows[0]["ClientKey"].ToString()), Credentials.Password);

                        password = Encryption.EncryptString(Encryption.DecryptString(password, clientKey), serverKey);
                        return(WebServiceDAL.LinkUserToUniverseAccount(userId, universeId, playerId, playerName, password));
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                // Log it
                WebServiceDAL.StoreException("Webservice", "SynchronizeCredentials", ex);
                return(false);
            }
        }