generator-razor 14.0.7 → 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 -10
  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,14 +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
-
708
741
  content = this._substituteMarker(
709
742
  content,
710
743
  '###PASS###',
711
- passwordHash
744
+ this.passwordHash
712
745
  )
713
746
 
714
747
  await fs.writeFile(
@@ -877,14 +910,10 @@ export default class extends Generator {
877
910
  this.props.User
878
911
  )
879
912
 
880
- const passwordHash = await argon2.hash(
881
- this.props.Pass
882
- )
883
-
884
913
  sql = this._substituteMarker(
885
914
  sql,
886
915
  '###PASS###',
887
- passwordHash
916
+ this.passwordHash
888
917
  )
889
918
 
890
919
  await connection.query(sql)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "generator-razor",
3
- "version": "14.0.7",
3
+ "version": "14.0.9",
4
4
  "description": "Yeoman generator for razor TYPO3 distribution",
5
5
  "license": "MIT",
6
6
  "main": "app/index.js",