diff --git a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml index fe1f049e5e..aa1372494f 100644 --- a/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml +++ b/interface/resources/qml/hifi/commerce/inspectionCertificate/InspectionCertificate.qml @@ -200,12 +200,6 @@ Rectangle { // Style color: hifi.colors.lightGray; } - FontLoader { id: ralewayRegular; source: "../../../../fonts/Raleway-Regular.ttf"; } - TextMetrics { - id: textMetrics; - font.family: ralewayRegular.name - text: root.itemOwner; - } RalewayRegular { id: ownedBy; text: root.itemOwner; @@ -215,8 +209,7 @@ Rectangle { anchors.top: ownedByHeader.bottom; anchors.topMargin: 8; anchors.left: ownedByHeader.left; - height: textMetrics.height; - width: root.isMyCert ? textMetrics.width + 25 : ownedByHeader.width; + height: paintedHeight; // Style color: hifi.colors.darkGray; elide: Text.ElideRight; @@ -231,7 +224,7 @@ Rectangle { anchors.topMargin: 4; anchors.bottom: ownedBy.bottom; anchors.left: ownedBy.right; - anchors.leftMargin: 4; + anchors.leftMargin: 6; anchors.right: ownedByHeader.right; // Style color: hifi.colors.lightGray; diff --git a/interface/resources/qml/hifi/commerce/wallet/Help.qml b/interface/resources/qml/hifi/commerce/wallet/Help.qml index 65c06994f8..7cada5e914 100644 --- a/interface/resources/qml/hifi/commerce/wallet/Help.qml +++ b/interface/resources/qml/hifi/commerce/wallet/Help.qml @@ -90,17 +90,22 @@ Item { ListElement { isExpanded: false; question: "What are private keys?" - answer: qsTr("A private key is a secret piece of text that is used to decrypt code.

In High Fidelity, your private keys are used to decrypt the contents of your Wallet and Purchases."); + answer: qsTr("A private key is a secret piece of text that is used to prove ownership, unlock confidential information, and sign transactions.

In High Fidelity, your private keys are used to securely access the contents of your Wallet and Purchases."); } ListElement { isExpanded: false; question: "Where are my private keys stored?" - answer: qsTr('Your private keys are only stored on your hard drive in High Fidelity Interface\'s AppData directory.

Tap here to open the file path of your hifikey in your file explorer.

You may backup this file by copying it to a USB flash drive, or to a service like Dropbox or Google Drive. Restore your backup by replacing the file in Interface\'s AppData directory with your backed-up copy.'); + answer: qsTr('By default, your private keys are only stored on your hard drive in High Fidelity Interface\'s AppData directory.

Tap here to open the file path of your hifikey in your file explorer.'); + } + ListElement { + isExpanded: false; + question: "How can I backup my private keys?" + answer: qsTr('You may backup the file containing your private keys by copying it to a USB flash drive, or to a service like Dropbox or Google Drive.

Restore your backup by replacing the file in Interface\'s AppData directory with your backed-up copy.

Tap here to open the file path of your hifikey in your file explorer.'); } ListElement { isExpanded: false; question: "What happens if I lose my passphrase?" - answer: qsTr("If you lose your passphrase, you will no longer have access to the contents of your Wallet or My Purchases.

Nobody can help you recover your passphrase, including High Fidelity. Please write it down and store it securely."); + answer: qsTr("Your passphrase is used to encrypt your private keys. If you lose your passphrase, you will no longer be able to decrypt your private key file. You will also no longer have access to the contents of your Wallet or My Purchases.

Nobody can help you recover your passphrase, including High Fidelity. Please write it down and store it securely."); } ListElement { isExpanded: false; diff --git a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml index 0075e86bdc..99fe933bd6 100644 --- a/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml +++ b/interface/resources/qml/hifi/commerce/wallet/WalletSetup.qml @@ -679,7 +679,7 @@ Item { anchors.right: parent.right; anchors.rightMargin: 30; height: 40; - text: "Open Instructions for Later"; + text: "Open Backup Instructions for Later"; onClicked: { instructions01Container.visible = false; instructions02Container.visible = true; diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index d7227a58f7..faa95b2a40 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -105,19 +105,19 @@ RSA* readKeys(const char* filename) { return key; } -bool writeBackupInstructions() { +bool Wallet::writeBackupInstructions() { QString inputFilename(PathUtils::resourcesPath() + "html/commerce/backup_instructions.html"); - QString filename = PathUtils::getAppDataFilePath(INSTRUCTIONS_FILE); - QFile outputFile(filename); + QString outputFilename = PathUtils::getAppDataFilePath(INSTRUCTIONS_FILE); + QFile outputFile(outputFilename); bool retval = false; - if (QFile::exists(filename)) + if (QFile::exists(outputFilename) || getKeyFilePath() == "") { - QFile::remove(filename); + return false; } - QFile::copy(inputFilename, filename); + QFile::copy(inputFilename, outputFilename); - if (QFile::exists(filename) && outputFile.open(QIODevice::ReadWrite)) { + if (QFile::exists(outputFilename) && outputFile.open(QIODevice::ReadWrite)) { QByteArray fileData = outputFile.readAll(); QString text(fileData); @@ -132,7 +132,7 @@ bool writeBackupInstructions() { retval = true; qCDebug(commerce) << "wrote html file successfully"; } else { - qCDebug(commerce) << "failed to open output html file" << filename; + qCDebug(commerce) << "failed to open output html file" << outputFilename; } return retval; } @@ -154,8 +154,6 @@ bool writeKeys(const char* filename, RSA* keys) { QFile(QString(filename)).remove(); return retval; } - - writeBackupInstructions(); retval = true; qCDebug(commerce) << "wrote keys successfully"; @@ -359,6 +357,8 @@ bool Wallet::setPassphrase(const QString& passphrase) { _publicKeys.clear(); + writeBackupInstructions(); + return true; } @@ -526,6 +526,8 @@ bool Wallet::generateKeyPair() { qCInfo(commerce) << "Generating keypair."; auto keyPair = generateRSAKeypair(); + writeBackupInstructions(); + // TODO: redo this soon -- need error checking and so on writeSecurityImage(_securityImage, keyFilePath()); QString oldKey = _publicKeys.count() == 0 ? "" : _publicKeys.last(); diff --git a/interface/src/commerce/Wallet.h b/interface/src/commerce/Wallet.h index 38c5299810..31df2df918 100644 --- a/interface/src/commerce/Wallet.h +++ b/interface/src/commerce/Wallet.h @@ -80,6 +80,7 @@ private: void updateImageProvider(); bool writeSecurityImage(const QPixmap* pixmap, const QString& outputFilePath); bool readSecurityImage(const QString& inputFilePath, unsigned char** outputBufferPtr, int* outputBufferLen); + bool writeBackupInstructions(); bool verifyOwnerChallenge(const QByteArray& encryptedText, const QString& publicKey, QString& decryptedText); diff --git a/scripts/system/html/js/marketplacesInject.js b/scripts/system/html/js/marketplacesInject.js index fc16eae8bf..0f4fe58586 100644 --- a/scripts/system/html/js/marketplacesInject.js +++ b/scripts/system/html/js/marketplacesInject.js @@ -193,6 +193,11 @@ var navbarBrandElement = document.getElementsByClassName('navbar-brand')[0]; var purchasesElement = document.createElement('a'); var dropDownElement = document.getElementById('user-dropdown'); + + $('#user-dropdown').find('.username')[0].style = "max-width:80px;white-space:nowrap;overflow:hidden;" + + "text-overflow:ellipsis;display:inline-block;position:relative;top:4px;"; + $('#user-dropdown').find('.caret')[0].style = "position:relative;top:-3px;"; + purchasesElement.id = "purchasesButton"; purchasesElement.setAttribute('href', "#"); purchasesElement.innerHTML = "My Purchases";