sumba 1.0.21 → 1.0.23

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 (96) hide show
  1. package/bajo/hook/dobo.sumba-user@after-record-update.js +22 -6
  2. package/bajo/hook/dobo.sumba-user@after-record-validation.js +1 -1
  3. package/bajo/intl/en-US.json +8 -6
  4. package/bajo/intl/id.json +8 -6
  5. package/{waibuMpa → bajoTemplate}/layout/default.html +1 -1
  6. package/{waibuMpa → bajoTemplate}/layout/info.html +4 -4
  7. package/{waibuMpa → bajoTemplate}/layout/wide.html +4 -4
  8. package/bajoTemplate/partial/_mail/mystuff-change-password.html +3 -0
  9. package/bajoTemplate/partial/_mail/mystuff-change-password.id.html +3 -0
  10. package/bajoTemplate/partial/_mail/mystuff-reset-api-key.html +3 -0
  11. package/bajoTemplate/partial/_mail/mystuff-reset-api-key.id.html +4 -0
  12. package/{waibuMpa → bajoTemplate}/partial/help/trouble-tickets/list.html +1 -1
  13. package/{waibuMpa → bajoTemplate}/partial/my-stuff/profile/edit.html +3 -3
  14. package/{waibuMpa → bajoTemplate}/partial/my-stuff/profile/view.html +2 -2
  15. package/bajoTemplate/partial/my-stuff/reset-api-key.html +10 -0
  16. package/{waibuMpa → bajoTemplate}/partial/signin.html +3 -3
  17. package/bajoTemplate/partial/user/activation.html +10 -0
  18. package/{waibuMpa → bajoTemplate}/partial/user/forgot-password.html +4 -4
  19. package/bajoTemplate/partial/user/fpl-invalid.html +1 -0
  20. package/{waibuMpa → bajoTemplate}/partial/user/signup/form.html +3 -3
  21. package/{waibuMpa → bajoTemplate}/partial/user/signup/success.html +2 -2
  22. package/bajoTemplate/template/_mail/user-forgot-password-link.html +3 -0
  23. package/bajoTemplate/template/_mail/user-signup-success.html +3 -0
  24. package/dobo/schema/user.json +1 -1
  25. package/package.json +1 -1
  26. package/waibuMpa/route/help/trouble-tickets/details/@id.js +0 -1
  27. package/waibuMpa/route/my-stuff/change-password.js +2 -2
  28. package/waibuMpa/route/my-stuff/profile/edit.js +14 -10
  29. package/waibuMpa/route/my-stuff/profile.js +2 -1
  30. package/waibuMpa/route/my-stuff/reset-api-key.js +3 -3
  31. package/waibuMpa/route/user/forgot-password/@fpl.js +0 -1
  32. package/waibuMpa/partial/my-stuff/reset-api-key.html +0 -12
  33. package/waibuMpa/partial/user/activation.html +0 -10
  34. package/waibuMpa/partial/user/fpl-invalid.html +0 -1
  35. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-activation-success.html +0 -0
  36. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-activation-success.id.html +0 -0
  37. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-changed.html +0 -0
  38. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-changed.id.html +0 -0
  39. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-link.html +0 -0
  40. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-link.id.html +0 -0
  41. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-signup-success.html +0 -0
  42. /package/{waibuMpa → bajoTemplate}/partial/_mail/user-signup-success.id.html +0 -0
  43. /package/{waibuMpa → bajoTemplate}/partial/api-key-modal.html +0 -0
  44. /package/{waibuMpa → bajoTemplate}/partial/app-launcher.html +0 -0
  45. /package/{waibuMpa → bajoTemplate}/partial/help/contact-form/form.html +0 -0
  46. /package/{waibuMpa → bajoTemplate}/partial/help/contact-form/success.html +0 -0
  47. /package/{waibuMpa → bajoTemplate}/partial/help/trouble-tickets/add.html +0 -0
  48. /package/{waibuMpa → bajoTemplate}/partial/help/trouble-tickets/details.html +0 -0
  49. /package/{waibuMpa → bajoTemplate}/partial/layout/breadcrumb.html +0 -0
  50. /package/{waibuMpa → bajoTemplate}/partial/layout/footer.html +0 -0
  51. /package/{waibuMpa → bajoTemplate}/partial/layout/navbar.html +0 -0
  52. /package/{waibuMpa → bajoTemplate}/partial/layout/sidebar.html +0 -0
  53. /package/{waibuMpa → bajoTemplate}/partial/list-item/change-password.html +0 -0
  54. /package/{waibuMpa → bajoTemplate}/partial/list-item/forgot-password.html +0 -0
  55. /package/{waibuMpa → bajoTemplate}/partial/list-item/goto-home.html +0 -0
  56. /package/{waibuMpa → bajoTemplate}/partial/list-item/member-links.html +0 -0
  57. /package/{waibuMpa → bajoTemplate}/partial/list-item/signin.html +0 -0
  58. /package/{waibuMpa → bajoTemplate}/partial/list-item/signout.html +0 -0
  59. /package/{waibuMpa → bajoTemplate}/partial/list-item/user-signup.html +0 -0
  60. /package/{waibuMpa → bajoTemplate}/partial/list-item/your-profile.html +0 -0
  61. /package/{waibuMpa → bajoTemplate}/partial/my-stuff/change-password.html +0 -0
  62. /package/{waibuMpa → bajoTemplate}/partial/signout.html +0 -0
  63. /package/{waibuMpa → bajoTemplate}/partial/user/forgot-password-nomail.id.md +0 -0
  64. /package/{waibuMpa → bajoTemplate}/partial/user/fpl-invalid.id.md +0 -0
  65. /package/{waibuMpa → bajoTemplate}/partial/user/fpl-invalid.md +0 -0
  66. /package/{waibuMpa → bajoTemplate}/partial/user/fpl.html +0 -0
  67. /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-mail.id.md +0 -0
  68. /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-mail.md +0 -0
  69. /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-nomail.id.md +0 -0
  70. /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-nomail.md +0 -0
  71. /package/{waibuMpa/template/_mail/user-activation-success.html → bajoTemplate/template/_mail/mystuff-change-password.html} +0 -0
  72. /package/{waibuMpa/template/_mail/user-forgot-password-changed.html → bajoTemplate/template/_mail/mystuff-reset-api-key.html} +0 -0
  73. /package/{waibuMpa/template/_mail/user-forgot-password-link.html → bajoTemplate/template/_mail/user-activation-success.html} +0 -0
  74. /package/{waibuMpa/template/_mail/user-signup-success.html → bajoTemplate/template/_mail/user-forgot-password-changed.html} +0 -0
  75. /package/{waibuMpa → bajoTemplate}/template/help/contact-form/form.html +0 -0
  76. /package/{waibuMpa → bajoTemplate}/template/help/contact-form/success.html +0 -0
  77. /package/{waibuMpa → bajoTemplate}/template/help/trouble-tickets/add.html +0 -0
  78. /package/{waibuMpa → bajoTemplate}/template/help/trouble-tickets/details.html +0 -0
  79. /package/{waibuMpa → bajoTemplate}/template/help/trouble-tickets/list.html +0 -0
  80. /package/{waibuMpa → bajoTemplate}/template/info/about-us.id.md +0 -0
  81. /package/{waibuMpa → bajoTemplate}/template/info/about-us.md +0 -0
  82. /package/{waibuMpa → bajoTemplate}/template/info/cookie-policy.md +0 -0
  83. /package/{waibuMpa → bajoTemplate}/template/info/privacy.md +0 -0
  84. /package/{waibuMpa → bajoTemplate}/template/info/terms-conditions.md +0 -0
  85. /package/{waibuMpa → bajoTemplate}/template/my-stuff/change-password.html +0 -0
  86. /package/{waibuMpa → bajoTemplate}/template/my-stuff/profile/edit.html +0 -0
  87. /package/{waibuMpa → bajoTemplate}/template/my-stuff/profile/view.html +0 -0
  88. /package/{waibuMpa → bajoTemplate}/template/my-stuff/reset-api-key.html +0 -0
  89. /package/{waibuMpa → bajoTemplate}/template/signin.html +0 -0
  90. /package/{waibuMpa → bajoTemplate}/template/signout.html +0 -0
  91. /package/{waibuMpa → bajoTemplate}/template/user/activation.html +0 -0
  92. /package/{waibuMpa → bajoTemplate}/template/user/forgot-password.html +0 -0
  93. /package/{waibuMpa → bajoTemplate}/template/user/fpl-invalid.html +0 -0
  94. /package/{waibuMpa → bajoTemplate}/template/user/fpl.html +0 -0
  95. /package/{waibuMpa → bajoTemplate}/template/user/signup/form.html +0 -0
  96. /package/{waibuMpa → bajoTemplate}/template/user/signup/success.html +0 -0
@@ -1,13 +1,29 @@
1
1
  async function afterRecordUpdate (id, body, options = {}, rec) {
2
2
  if (!(this.app.masohi && this.app.masohiMail)) return
3
+
3
4
  const { data, oldData } = rec
4
- if (!(oldData.status === 'UNVERIFIED' && data.status === 'ACTIVE')) return
5
- options.tpl = 'sumba.template:/_mail/user-activation-success.html'
6
5
  const to = `${data.firstName} ${data.lastName} <${data.email}>`
7
- const subject = options.req.t('userActivation')
8
- try {
9
- await this.app.masohi.send({ to, subject, message: data, options })
10
- } catch (err) {}
6
+ let subject
7
+
8
+ const send = async () => {
9
+ try {
10
+ await this.app.masohi.send({ to, subject, message: data, options })
11
+ } catch (err) {
12
+ }
13
+ }
14
+ if (oldData.status === 'UNVERIFIED' && data.status === 'ACTIVE') {
15
+ subject = options.req.t('userActivation')
16
+ options.tpl = 'sumba.template:/_mail/user-activation-success.html'
17
+ await send()
18
+ } else if (oldData.token !== data.token) {
19
+ subject = options.req.t('resetApiKey')
20
+ options.tpl = 'sumba.template:/_mail/mystuff-reset-api-key.html'
21
+ await send()
22
+ } else if (body.password) {
23
+ subject = options.req.t('changePassword')
24
+ options.tpl = 'sumba.template:/_mail/mystuff-change-password.html'
25
+ await send()
26
+ }
11
27
  }
12
28
 
13
29
  export default afterRecordUpdate
@@ -3,7 +3,7 @@ async function doboSumbaUserAfterRecordValidation (body, options) {
3
3
  const { has } = this.app.bajo.lib._
4
4
 
5
5
  if (has(body, 'password') && !isBcrypt(body.password)) body.password = await hash(body.password, 'bcrypt')
6
- if (has(body, 'token') && !isMd5(body.token)) body.token = await hash(body.password)
6
+ if (has(body, 'token') && !isMd5(body.token)) body.token = await hash(body.password ?? body.token)
7
7
  }
8
8
 
9
9
  export default doboSumbaUserAfterRecordValidation
@@ -87,11 +87,13 @@
87
87
  "cat": "Category"
88
88
  },
89
89
  "validation": {
90
- "password.minOfUppercase": "Contains at leaset {{min}} uppercase characters",
91
- "password.minOfSpecialCharacters": "Contains at least {{min}} special characters",
92
- "password.minOfLowercase": "Contains at least {{min}} special characters",
93
- "password.minOfNumeric": "Contains at least {{min}} numerical characters",
94
- "password.noWhiteSpaces": "No space allowed",
95
- "password.onlyLatinCharacters": "Only latin characters allowed"
90
+ "password": {
91
+ "minOfUppercase": "Contains at leaset %(min)s uppercase characters",
92
+ "minOfSpecialCharacters": "Contains at least %(min)s special characters",
93
+ "minOfLowercase": "Contains at least %(min)s special characters",
94
+ "minOfNumeric": "Contains at least %(min)s numerical characters",
95
+ "noWhiteSpaces": "No space allowed",
96
+ "onlyLatinCharacters": "Only latin characters allowed"
97
+ }
96
98
  }
97
99
  }
package/bajo/intl/id.json CHANGED
@@ -89,11 +89,13 @@
89
89
  "cat": "Kategori"
90
90
  },
91
91
  "validation": {
92
- "password.minOfUppercase": "Mengandung setidaknya {{min}} huruf besar",
93
- "password.minOfSpecialCharacters": "Mengandung setidaknya {{min}} karakter spesial",
94
- "password.minOfLowercase": "Mengandung setidaknya {{min}} huruf kecil",
95
- "password.minOfNumeric": "Mengandung setidaknya {{min}} numerik/angka",
96
- "password.noWhiteSpaces": "Tidak boleh ada spasi",
97
- "password.onlyLatinCharacters": "Harus berupa karakter latin saja"
92
+ "password": {
93
+ "minOfUppercase": "Mengandung setidaknya %(min)s huruf besar",
94
+ "minOfSpecialCharacters": "Mengandung setidaknya %(min)s karakter spesial",
95
+ "minOfLowercase": "Mengandung setidaknya %(min)s huruf kecil",
96
+ "minOfNumeric": "Mengandung setidaknya %(min)s numerik/angka",
97
+ "noWhiteSpaces": "Tidak boleh ada spasi",
98
+ "onlyLatinCharacters": "Harus berupa karakter latin saja"
99
+ }
98
100
  }
99
101
  }
@@ -8,7 +8,7 @@
8
8
  <c:app-launcher trigger />
9
9
  <c:heading margin="bottom-4" text="align:center" type="3-display" content="<%= page.title %>" />
10
10
  <!-- body -->
11
- <c:include resource="sumba.partial:/layout/footer.html" />
11
+ <!-- include sumba.partial:/layout/footer.html -->
12
12
  </c:grid-col>
13
13
  <c:grid-col col="4-md"></c:grid-col>
14
14
  </c:grid-row>
@@ -1,13 +1,13 @@
1
1
  <c:page-start title="<%= page.fullTitle %>" />
2
2
  <c:main flex>
3
- <c:include resource="sumba.partial:/layout/sidebar.html" />
3
+ <!-- include sumba.partial:/layout/sidebar.html -->
4
4
  <c:div flex="fill column">
5
- <c:include resource="sumba.partial:/layout/navbar.html" />
6
- <c:include resource="sumba.partial:/layout/breadcrumb.html" />
5
+ <!-- include sumba.partial:/layout/navbar.html -->
6
+ <!-- include sumba.partial:/layout/breadcrumb.html -->
7
7
  <c:container margin="start-0 bottom-5" padding="x-3">
8
8
  <c:div style="max-width: 992px;">
9
9
  <!-- body -->
10
- <c:include resource="sumba.partial:/layout/footer.html" />
10
+ <!-- include sumba.partial:/layout/footer.html -->
11
11
  </c:div>
12
12
  </c:container>
13
13
  </c:div>
@@ -1,13 +1,13 @@
1
1
  <c:page-start title="<%= page.fullTitle %>" />
2
2
  <c:main flex>
3
- <c:include resource="sumba.partial:/layout/sidebar.html" />
3
+ <!-- include sumba.partial:/layout/sidebar.html -->
4
4
  <c:div flex="fill column">
5
- <c:include resource="sumba.partial:/layout/navbar.html" />
6
- <c:include resource="sumba.partial:/layout/breadcrumb.html" />
5
+ <!-- include sumba.partial:/layout/navbar.html -->
6
+ <!-- include sumba.partial:/layout/breadcrumb.html -->
7
7
  <c:container margin="start-0 bottom-5" padding="x-3">
8
8
  <c:div style="max-width: 992px;">
9
9
  <!-- body -->
10
- <c:include resource="sumba.partial:/layout/footer.html" />
10
+ <!-- include sumba.partial:/layout/footer.html -->
11
11
  </c:div>
12
12
  </c:container>
13
13
  </c:div>
@@ -0,0 +1,3 @@
1
+ <p>Your password has been changed successfully. Please only use your new password
2
+ as the old one is no longer valid.</p>
3
+ <p>Thank you!</p>
@@ -0,0 +1,3 @@
1
+ <p>Kata sandi Anda telah diubah dengan sukses. Silahkan hanya gunakan kata sandi
2
+ baru Anda karena yang lama sudah tidak berlaku lagi.</p>
3
+ <p>Terima kasih!</p>
@@ -0,0 +1,3 @@
1
+ <p>Your API key has been successfully reset. Please make sure to use the new key
2
+ in every connected application as the old key is no longer valid.</p>
3
+ <p>Thank you!</p>
@@ -0,0 +1,4 @@
1
+ <p>Kunci API Anda telah direset dengan sukses. Pastikan untuk memakai
2
+ kunci baru di setiap aplikasi yang terhubung karena kunci yang lama sudah
3
+ tidak berlaku lagi.</p>
4
+ <p>Terima kasih!</p>
@@ -7,4 +7,4 @@
7
7
  </c:grid-col>
8
8
  </c:grid-row>
9
9
  <c:wdb-table responsive body-divider strip hover details-href="sumba:/help/trouble-tickets/details/:id" />
10
- <c:include resource="waibuDb.partial:/crud/_list-footer.html" />
10
+ <!-- include waibuDb.partial:/crud/_list-footer.html -->
@@ -1,4 +1,4 @@
1
- <c:form referer>
1
+ <c:form referer enctype="multipart/form-data">
2
2
  <c:grid-row>
3
3
  <c:grid-col col="8-md">
4
4
  <c:fieldset t:legend="meta" grid-gutter="2" margin="bottom-3">
@@ -24,7 +24,7 @@
24
24
  </c:grid-col>
25
25
  <c:grid-col col="4-md">
26
26
  <c:heading type="5" t:content="image" />
27
- <c:img holder="400x200" responsive rounded />
27
+ <c:img src="dobo:/attachment/SumbaUser/<%= form.id %>/profile/main.png" responsive rounded />
28
28
  <c:form-file name="image" no-label wrapper-margin="top-2"/>
29
29
  <c:btn-group margin="top-3" flex="full">
30
30
  <c:btn type="reset" t:content="reset" color="secondary" />
@@ -44,7 +44,7 @@
44
44
  <c:list type="unstyled" margin="top-3">
45
45
  <c:list-item href="sumba:/my-stuff/profile" t:content="backToProfile" icon="arrowStart" />
46
46
  </c:list>
47
- <c:include resource="sumba.partial:/api-key-modal.html" />
47
+ <!-- include sumba.partial:/api-key-modal.html -->
48
48
  </c:grid-col>
49
49
  </c:grid-row>
50
50
  </c:form>
@@ -23,12 +23,12 @@
23
23
  </c:grid-col>
24
24
  <c:grid-col col="4-md">
25
25
  <c:heading type="5" t:content="image" />
26
- <c:img holder="400x200" responsive rounded />
26
+ <c:img src="dobo:/attachment/SumbaUser/<%= form.id %>/profile/main.png" responsive rounded />
27
27
  <c:heading type="5" t:content="more" margin="top-3" />
28
28
  <c:list type="group" hover>
29
29
  <c:list-item href="sumba:/my-stuff/profile/edit" t:content="updateProfile" />
30
30
  <c:list-item t:content="displayApiKey" target="api-key-modal"/>
31
31
  </c:list>
32
- <c:include resource="sumba.partial:/api-key-modal.html" />
32
+ <!-- include sumba.partial:/api-key-modal.html -->
33
33
  </c:grid-col>
34
34
  </c:grid-row>
@@ -0,0 +1,10 @@
1
+ <c:grid-row>
2
+ <c:grid-col col="6-md">
3
+ <c:form button reset-validation>
4
+ <c:form-plaintext name="apiKey" label-floating wrapper-margin="bottom-2" />
5
+ <c:form-password name="password" label-floating wrapper-margin="bottom-3" />
6
+ </c:form>
7
+ </c:grid-col>
8
+ <c:grid-col col="6-md">
9
+ </c:grid-col>
10
+ </c:grid-row>
@@ -4,8 +4,8 @@
4
4
  </c:form>
5
5
  <% if (!page.noLinks) { %>
6
6
  <c:list type="unstyled" margin="start-3">
7
- <c:include resource="sumba.partial:/list-item/forgot-password.html" />
8
- <c:include resource="sumba.partial:/list-item/user-signup.html" />
9
- <c:include resource="sumba.partial:/list-item/goto-home.html" />
7
+ <!-- include sumba.partial:/list-item/forgot-password.html -->
8
+ <!-- include sumba.partial:/list-item/user-signup.html -->
9
+ <!-- include sumba.partial:/list-item/goto-home.html -->
10
10
  </c:list>
11
11
  <% } %>
@@ -0,0 +1,10 @@
1
+ <c:form button reset-validation referer>
2
+ <c:form-input name="key" label-floating />
3
+ </c:form>
4
+ <% if (!page.noLinks) { %>
5
+ <c:list type="unstyled" margin="start-3">
6
+ <!-- include sumba.partial:/list-item/signin.html -->
7
+ <!-- include sumba.partial:/list-item/forgot-password.html -->
8
+ <!-- include sumba.partial:/list-item/goto-home.html -->
9
+ </c:list>
10
+ <% } %>
@@ -3,12 +3,12 @@
3
3
  <c:form-input name="usernameEmail" label-floating wrapper-margin="bottom-2" t:hint="linkPasswordWillbeSent"/>
4
4
  </c:form>
5
5
  <% } else { %>
6
- <c:include resource="sumba.partial:/user/forgot-password-nomail.md" />
6
+ <!-- include sumba.partial:/user/forgot-password-nomail.md" />
7
7
  <% } %>
8
8
  <% if (!page.noLinks) { %>
9
9
  <c:list type="unstyled" margin="start-3">
10
- <c:include resource="sumba.partial:/list-item/signin.html" />
11
- <c:include resource="sumba.partial:/list-item/user-signup.html" />
12
- <c:include resource="sumba.partial:/list-item/goto-home.html" />
10
+ <!-- include sumba.partial:/list-item/signin.html -->
11
+ <!-- include sumba.partial:/list-item/user-signup.html -->
12
+ <!-- include sumba.partial:/list-item/goto-home.html -->
13
13
  </c:list>
14
14
  <% } %>
@@ -0,0 +1 @@
1
+ <!-- include sumba.partial:/user/fpl-invalid.md" />
@@ -9,8 +9,8 @@
9
9
  </c:form>
10
10
  <% if (!page.noLinks) { %>
11
11
  <c:list type="unstyled" margin="start-3">
12
- <c:include resource="sumba.partial:/list-item/forgot-password.html" />
13
- <c:include resource="sumba.partial:/list-item/signin.html" />
14
- <c:include resource="sumba.partial:/list-item/goto-home.html" />
12
+ <!-- include sumba.partial:/list-item/forgot-password.html -->
13
+ <!-- include sumba.partial:/list-item/signin.html -->
14
+ <!-- include sumba.partial:/list-item/goto-home.html -->
15
15
  </c:list>
16
16
  <% } %>
@@ -1,7 +1,7 @@
1
1
  <% if (_hasPlugin('masohiMail')) { %>
2
- <c:include resource="sumba.partial:/user/signup/success-mail.md" />
2
+ <!-- include sumba.partial:/user/signup/success-mail.md" />
3
3
  <% } else { %>
4
- <c:include resource="sumba.partial:/user/signup/success-nomail.md" />
4
+ <!-- include sumba.partial:/user/signup/success-nomail.md" />
5
5
  <% } %>
6
6
  <% if (!page.noLinks) { %>
7
7
  <c:list type="unstyled" margin="start-3">
@@ -0,0 +1,3 @@
1
+ ---
2
+ layout: waibuMpa.layout:/email.html
3
+ ---
@@ -0,0 +1,3 @@
1
+ ---
2
+ layout: waibuMpa.layout:/email.html
3
+ ---
@@ -43,7 +43,7 @@
43
43
  "fields": ["email", "siteId"],
44
44
  "unique": true
45
45
  }],
46
- "hidden": ["password", "token"],
46
+ "hidden": ["password"],
47
47
  "feature": {
48
48
  "sumba.address": true,
49
49
  "sumba.social": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumba",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "Bajo Framework's Biz Suite",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -14,7 +14,6 @@ const id = {
14
14
  if (req.method === 'POST') {
15
15
  try {
16
16
  form.masterId = master.id + ''
17
- console.log(form, master)
18
17
  await recordCreate({ model: 'SumbaTicketDetail', req, body: form })
19
18
  return reply.redirectTo('sumba:/help/trouble-tickets/list')
20
19
  } catch (err) {
@@ -23,10 +23,10 @@ const profile = {
23
23
  } catch (err) {
24
24
  throw this.error('validationError', { details: err.details, values: err.values, ns: this.name, statusCode: 422, code: 'DB_VALIDATION' })
25
25
  }
26
- const rec = await recordGet(model, req.user.id)
26
+ const rec = await recordGet(model, req.user.id, { forceNoHidden: true })
27
27
  const verified = await bcrypt.compare(req.body.currentPassword, rec.password)
28
28
  if (!verified) throw this.error('invalidCurrentPassword', { details: [{ field: 'currentPassword', error: 'invalidPassword' }], statusCode: 400 })
29
- await recordUpdate(model, req.user.id, { password: req.body.newPassword }, { req, noFlash: true })
29
+ await recordUpdate(model, req.user.id, { password: req.body.newPassword }, { req, reply, noFlash: true })
30
30
  // signout and redirect to signin
31
31
  req.session.user = null
32
32
  req.flash('notify', req.t('passwordChangedReSignin'))
@@ -2,29 +2,33 @@ const profile = {
2
2
  method: ['GET', 'POST'],
3
3
  handler: async function (req, reply) {
4
4
  const { defaultsDeep } = this.app.bajo
5
- const { attachmentCopyUploaded } = this.app.dobo
5
+ // const { attachmentCopyUploaded } = this.app.dobo
6
6
  const { recordUpdate, recordGet } = this.app.waibuDb
7
- const { has } = this.app.bajo.lib._
7
+ const { omit, pick } = this.app.bajo.lib._
8
8
  const { hash } = this.app.bajoExtra
9
9
  const resp = await recordGet({ model: 'SumbaUser', req, id: req.user.id, options: { forceNoHidden: true, noHook: true, noCache: true } })
10
- let form = defaultsDeep(req.body, resp.data)
10
+ let form = defaultsDeep(req.body, omit(resp.data, ['password']))
11
+ form.token = await hash(form.token)
11
12
  let error
12
13
  if (req.method === 'POST') {
13
14
  try {
15
+ /*
14
16
  if (has(req.body, 'profile')) {
15
- const opts = { req, setField: 'profile', setFile: 'main.png' }
17
+ const opts = { req, setField: 'profile', setFile: 'main.png', noFlash: true }
16
18
  await attachmentCopyUploaded('SumbaUser', req.user.id, opts)
17
19
  } else {
18
- const resp = await recordUpdate({ req, model: 'SumbaUser', id: req.user.id, body: form, options: { noFlash: true, hidden: [] } })
19
- form = resp.data
20
- req.flash('notify', req.t('profileUpdated'))
21
- }
20
+ */
21
+ const body = pick(form, ['firstName', 'lastName', 'address1', 'address2', 'city', 'zipCode', 'provinceState', 'country', 'phone', 'website'])
22
+ const options = { noFlash: true, hidden: [], setField: 'profile', setFile: 'main.png' }
23
+ const resp = await recordUpdate({ req, reply, model: 'SumbaUser', id: req.user.id, body, options })
24
+ form = resp.data
25
+ req.flash('notify', req.t('profileUpdated'))
26
+ return reply.redirectTo('sumba:/my-stuff/profile')
27
+ // }
22
28
  } catch (err) {
23
- console.log(err)
24
29
  error = err
25
30
  }
26
31
  }
27
- if (form.token) form.token = await hash(form.token)
28
32
  return reply.view('sumba.template:/my-stuff/profile/edit.html', { form, error })
29
33
  }
30
34
  }
@@ -3,7 +3,8 @@ const profile = {
3
3
  handler: async function (req, reply) {
4
4
  const { hash } = this.app.bajoExtra
5
5
  const { recordGet } = this.app.waibuDb
6
- const resp = await recordGet({ model: 'SumbaUser', req, id: req.user.id, options: { forceNoHidden: true, noHook: true, noCache: true } })
6
+ const options = { forceNoHidden: true, noHook: true, noCache: true, attachment: true, mimeType: true }
7
+ const resp = await recordGet({ model: 'SumbaUser', req, id: req.user.id, options })
7
8
  const form = resp.data
8
9
  form.token = await hash(form.token)
9
10
  return reply.view('sumba.template:/my-stuff/profile/view.html', { form })
@@ -20,13 +20,13 @@ const resetApiKey = {
20
20
  } catch (err) {
21
21
  throw this.error('validationError', { details: err.details, values: err.values, ns: this.name, statusCode: 422, code: 'DB_VALIDATION' })
22
22
  }
23
- const rec = await recordGet(model, req.user.id)
23
+ const rec = await recordGet(model, req.user.id, { forceNoHidden: true })
24
24
  const verified = await bcrypt.compare(req.body.password, rec.password)
25
25
  if (!verified) throw this.error('validationError', { details: [{ field: 'password', error: 'invalidPassword' }], statusCode: 400 })
26
- await recordUpdate(model, req.user.id, { token: generateId() })
26
+ await recordUpdate(model, req.user.id, { token: generateId() }, { req, reply, noFlash: true })
27
27
  await delay(2000) // ensure req.user cache is expired
28
28
  req.flash('notify', req.t('resetApiKeySuccessfull'))
29
- return reply.redirectTo('sumba:/profile')
29
+ return reply.redirectTo('sumba:/my-stuff/profile')
30
30
  } catch (err) {
31
31
  error = err
32
32
  }
@@ -48,7 +48,6 @@ const forgotPasswordLink = {
48
48
  req.flash('notify', req.t('passwordChangedReSignin'))
49
49
  return reply.redirectTo(this.config.redirect.signin)
50
50
  } catch (err) {
51
- console.log(err)
52
51
  error = err
53
52
  }
54
53
  }
@@ -1,12 +0,0 @@
1
- <c:form button reset-validation>
2
- <c:form-plaintext name="apiKey" label-floating wrapper-margin="bottom-2" />
3
- <c:form-password name="password" label-floating wrapper-margin="bottom-3" />
4
- </c:form>
5
- <% if (!page.noLinks) { %>
6
- <c:list type="unstyled" margin="start-3">
7
- <c:include resource="sumba.partial:/list-item/your-profile.html" />
8
- <c:include resource="sumba.partial:/list-item/change-password.html" />
9
- <c:include resource="sumba.partial:/list-item/signout.html" />
10
- <c:include resource="sumba.partial:/list-item/goto-home.html" />
11
- </c:list>
12
- <% } %>
@@ -1,10 +0,0 @@
1
- <c:form button reset-validation referer>
2
- <c:form-input name="key" label-floating />
3
- </c:form>
4
- <% if (!page.noLinks) { %>
5
- <c:list type="unstyled" margin="start-3">
6
- <c:include resource="sumba.partial:/list-item/signin.html" />
7
- <c:include resource="sumba.partial:/list-item/forgot-password.html" />
8
- <c:include resource="sumba.partial:/list-item/goto-home.html" />
9
- </c:list>
10
- <% } %>
@@ -1 +0,0 @@
1
- <c:include resource="sumba.partial:/user/fpl-invalid.md" />
File without changes
File without changes