Merge pull request #11594 from zfox23/commerce_octoberTweaks

2017-10-13 Commerce frontend tweaks
This commit is contained in:
Zach Fox 2017-10-16 09:25:43 -07:00 committed by GitHub
commit c25008cff3
6 changed files with 29 additions and 23 deletions

View file

@ -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;

View file

@ -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.<br><br>In High Fidelity, <b>your private keys are used to decrypt the contents of your Wallet and Purchases.</b>");
answer: qsTr("A private key is a secret piece of text that is used to prove ownership, unlock confidential information, and sign transactions.<br><br>In High Fidelity, <b>your private keys are used to securely access the contents of your Wallet and Purchases.</b>");
}
ListElement {
isExpanded: false;
question: "Where are my private keys stored?"
answer: qsTr('Your private keys are <b>only stored on your hard drive</b> in High Fidelity Interface\'s AppData directory.<br><br><b><font color="#0093C5"><a href="#privateKeyPath">Tap here to open the file path of your hifikey in your file explorer.</a></font></b><br><br> 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 <b>only stored on your hard drive</b> in High Fidelity Interface\'s AppData directory.<br><br><b><font color="#0093C5"><a href="#privateKeyPath">Tap here to open the file path of your hifikey in your file explorer.</a></font></b>');
}
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.<br><br>Restore your backup by replacing the file in Interface\'s AppData directory with your backed-up copy.<br><br><b><font color="#0093C5"><a href="#privateKeyPath">Tap here to open the file path of your hifikey in your file explorer.</a></font></b>');
}
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.<br><br><b>Nobody can help you recover your passphrase, including High Fidelity.</b> 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.<br><br><b>Nobody can help you recover your passphrase, including High Fidelity.</b> Please write it down and store it securely.");
}
ListElement {
isExpanded: false;

View file

@ -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;

View file

@ -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();

View file

@ -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);

View file

@ -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";