Skip to content

Commit 93b4bab

Browse files
authored
Merge pull request #793 from particle-iot/bug/sc-133701/tachyon-setup-is-rehashing-an-already-hashed
Bug/sc 133701/tachyon setup is rehashing an already hashed
2 parents 3570ae1 + 2c0e8c4 commit 93b4bab

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/cmd/setup-tachyon.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module.exports = class SetupTachyonCommands extends CLICommandBase {
3232

3333
async setup({ skip_flashing_os: skipFlashingOs, version, load_config: loadConfig, save_config: saveConfig }) {
3434
try {
35+
const loadedFromFile = !!loadConfig;
3536
this._showWelcomeMessage();
3637
this._formatAndDisplaySteps("Okay—first up! Checking if you're logged in...", 1);
3738

@@ -98,7 +99,11 @@ module.exports = class SetupTachyonCommands extends CLICommandBase {
9899
const { path: configBlobPath, configBlob } = await this._runStepWithTiming(
99100
'Creating the configuration file to write to the Tachyon device...',
100101
6,
101-
() => this._createConfigBlob({ registrationCode, ...config })
102+
() => this._createConfigBlob({
103+
loadedFromFile,
104+
registrationCode,
105+
...config
106+
})
102107
);
103108
const xmlPath = await this._createXmlFile(configBlobPath);
104109
// Save the config file if requested
@@ -118,7 +123,7 @@ module.exports = class SetupTachyonCommands extends CLICommandBase {
118123
() => this._flash({
119124
files: [packagePath, xmlPath],
120125
skipFlashingOs,
121-
silent: !!loadConfig
126+
silent: loadedFromFile
122127
})
123128
);
124129

@@ -405,7 +410,7 @@ Welcome to the Particle Tachyon setup! This interactive command:
405410
}
406411
];
407412
const res = await this.ui.prompt(questions);
408-
const { password } = await this.ui.promptPasswordWithConfirmation({
413+
const password = await this.ui.promptPasswordWithConfirmation({
409414
customMessage: 'Enter your WiFi password:',
410415
customConfirmationMessage: 'Re-enter your WiFi password:'
411416
});
@@ -453,11 +458,11 @@ Welcome to the Particle Tachyon setup! This interactive command:
453458
return data.registration_code;
454459
}
455460

456-
async _createConfigBlob({ registrationCode, systemPassword, wifi, sshPublicKey, productId }) {
461+
async _createConfigBlob({ loadedFromFile = false, registrationCode, systemPassword, wifi, sshPublicKey, productId }) {
457462
// Format the config and registration code into a config blob (JSON file, prefixed by the file size)
458463
const config = {
459464
registrationCode: registrationCode,
460-
systemPassword : this._generateShadowCompatibleHash(systemPassword),
465+
systemPassword : loadedFromFile ? systemPassword : this._generateShadowCompatibleHash(systemPassword)
461466
};
462467

463468
if (wifi) {

0 commit comments

Comments
 (0)