generator-razor 14.0.8 → 14.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/app/index.js +39 -16
  2. package/package.json +1 -1
package/app/index.js CHANGED
@@ -307,7 +307,44 @@ export default class extends Generator {
307
307
  store: true
308
308
  }]
309
309
 
310
+ const storedPromptNames = prompts
311
+ .filter(prompt => prompt.store === true)
312
+ .map(prompt => prompt.name)
313
+
314
+ for (const prompt of prompts) {
315
+ if (
316
+ prompt.store === true &&
317
+ this.config.get(prompt.name) !== undefined
318
+ ) {
319
+ prompt.default = this.config.get(prompt.name)
320
+ }
321
+ }
322
+
310
323
  this.props = await this.prompt(prompts)
324
+
325
+ for (const name of storedPromptNames) {
326
+ this.config.set(name, this.props[name])
327
+ }
328
+
329
+ await this.config.save()
330
+
331
+ if (
332
+ typeof this.props.Pass !== 'string' ||
333
+ this.props.Pass.length === 0
334
+ ) {
335
+ throw new Error('TYPO3 password is empty.')
336
+ }
337
+
338
+ this.passwordHash = await argon2.hash(
339
+ this.props.Pass,
340
+ {
341
+ type: argon2.argon2id
342
+ }
343
+ )
344
+
345
+ if (!await argon2.verify(this.passwordHash, this.props.Pass)) {
346
+ throw new Error('Generated TYPO3 password hash is invalid.')
347
+ }
311
348
  }
312
349
 
313
350
  async writing () {
@@ -701,17 +738,10 @@ export default class extends Generator {
701
738
  encryptionKey
702
739
  )
703
740
 
704
- const passwordHash = await argon2.hash(
705
- this.props.Pass,
706
- {
707
- type: argon2.argon2i
708
- }
709
- )
710
-
711
741
  content = this._substituteMarker(
712
742
  content,
713
743
  '###PASS###',
714
- passwordHash
744
+ this.passwordHash
715
745
  )
716
746
 
717
747
  await fs.writeFile(
@@ -880,17 +910,10 @@ export default class extends Generator {
880
910
  this.props.User
881
911
  )
882
912
 
883
- const passwordHash = await argon2.hash(
884
- this.props.Pass,
885
- {
886
- type: argon2.argon2i
887
- }
888
- )
889
-
890
913
  sql = this._substituteMarker(
891
914
  sql,
892
915
  '###PASS###',
893
- passwordHash
916
+ this.passwordHash
894
917
  )
895
918
 
896
919
  await connection.query(sql)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.0.8",
3
+ "version": "14.0.9",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",