Exemple #1
0
    /// <summary>
    /// Updates OpenID for given user.
    /// </summary>
    private void UpdateOpenID(UserInfo ui)
    {
        if (ui != null)
        {
            string oldOpenID = OpenIDUserInfoProvider.GetOpenIDByUserID(ui.UserID) ?? "";
            string newOpenID = txtOpenID.Text.Trim();

            // Only update if Open ID has changed
            if (newOpenID != oldOpenID)
            {
                UserInfo uiUpdated = OpenIDUserInfoProvider.GetUserInfoByOpenID(newOpenID);

                // Make sure that only non-existing OpenID identifier can be saved
                if ((uiUpdated == null) || (uiUpdated.UserID == ui.UserID))
                {
                    // Update or delete given OpenID related to user
                    OpenIDUserInfoProvider.UpdateOpenIDUserInfo(oldOpenID, newOpenID, ui.UserID);
                }
                else
                {
                    ShowError(GetString("mem.openid.idassignedto") + uiUpdated.UserName);
                }
            }
        }
    }
    /// <summary>
    /// Updates OpenID for given user.
    /// </summary>
    private void UpdateOpenID(UserInfo ui)
    {
        if (ui != null)
        {
            string   oldOpenID = OpenIDUserInfoProvider.GetOpenIDByUserID(ui.UserID);
            string   newOpenID = txtOpenID.Text.Trim();
            UserInfo uiUpdated = OpenIDUserInfoProvider.GetUserInfoByOpenID(newOpenID);

            // Make sure that only non-existing OpenID identificator can be saved
            if ((uiUpdated == null) || (uiUpdated.UserID == ui.UserID))
            {
                // Update or delete given OpenID related to user
                OpenIDUserInfoProvider.UpdateOpenIDUserInfo(oldOpenID, newOpenID, ui.UserID);
            }
            else
            {
                lblError.Text    = GetString("mem.openid.idassignedto") + uiUpdated.UserName;
                lblError.Visible = true;
            }
        }
    }