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.
- package/bajo/hook/dobo.sumba-user@after-record-update.js +22 -6
- package/bajo/hook/dobo.sumba-user@after-record-validation.js +1 -1
- package/bajo/intl/en-US.json +8 -6
- package/bajo/intl/id.json +8 -6
- package/{waibuMpa → bajoTemplate}/layout/default.html +1 -1
- package/{waibuMpa → bajoTemplate}/layout/info.html +4 -4
- package/{waibuMpa → bajoTemplate}/layout/wide.html +4 -4
- package/bajoTemplate/partial/_mail/mystuff-change-password.html +3 -0
- package/bajoTemplate/partial/_mail/mystuff-change-password.id.html +3 -0
- package/bajoTemplate/partial/_mail/mystuff-reset-api-key.html +3 -0
- package/bajoTemplate/partial/_mail/mystuff-reset-api-key.id.html +4 -0
- package/{waibuMpa → bajoTemplate}/partial/help/trouble-tickets/list.html +1 -1
- package/{waibuMpa → bajoTemplate}/partial/my-stuff/profile/edit.html +3 -3
- package/{waibuMpa → bajoTemplate}/partial/my-stuff/profile/view.html +2 -2
- package/bajoTemplate/partial/my-stuff/reset-api-key.html +10 -0
- package/{waibuMpa → bajoTemplate}/partial/signin.html +3 -3
- package/bajoTemplate/partial/user/activation.html +10 -0
- package/{waibuMpa → bajoTemplate}/partial/user/forgot-password.html +4 -4
- package/bajoTemplate/partial/user/fpl-invalid.html +1 -0
- package/{waibuMpa → bajoTemplate}/partial/user/signup/form.html +3 -3
- package/{waibuMpa → bajoTemplate}/partial/user/signup/success.html +2 -2
- package/bajoTemplate/template/_mail/user-forgot-password-link.html +3 -0
- package/bajoTemplate/template/_mail/user-signup-success.html +3 -0
- package/dobo/schema/user.json +1 -1
- package/package.json +1 -1
- package/waibuMpa/route/help/trouble-tickets/details/@id.js +0 -1
- package/waibuMpa/route/my-stuff/change-password.js +2 -2
- package/waibuMpa/route/my-stuff/profile/edit.js +14 -10
- package/waibuMpa/route/my-stuff/profile.js +2 -1
- package/waibuMpa/route/my-stuff/reset-api-key.js +3 -3
- package/waibuMpa/route/user/forgot-password/@fpl.js +0 -1
- package/waibuMpa/partial/my-stuff/reset-api-key.html +0 -12
- package/waibuMpa/partial/user/activation.html +0 -10
- package/waibuMpa/partial/user/fpl-invalid.html +0 -1
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-activation-success.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-activation-success.id.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-changed.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-changed.id.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-link.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-forgot-password-link.id.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-signup-success.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/_mail/user-signup-success.id.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/api-key-modal.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/app-launcher.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/help/contact-form/form.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/help/contact-form/success.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/help/trouble-tickets/add.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/help/trouble-tickets/details.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/layout/breadcrumb.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/layout/footer.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/layout/navbar.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/layout/sidebar.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/change-password.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/forgot-password.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/goto-home.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/member-links.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/signin.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/signout.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/user-signup.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/list-item/your-profile.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/my-stuff/change-password.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/signout.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/forgot-password-nomail.id.md +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/fpl-invalid.id.md +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/fpl-invalid.md +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/fpl.html +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-mail.id.md +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-mail.md +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-nomail.id.md +0 -0
- /package/{waibuMpa → bajoTemplate}/partial/user/signup/success-nomail.md +0 -0
- /package/{waibuMpa/template/_mail/user-activation-success.html → bajoTemplate/template/_mail/mystuff-change-password.html} +0 -0
- /package/{waibuMpa/template/_mail/user-forgot-password-changed.html → bajoTemplate/template/_mail/mystuff-reset-api-key.html} +0 -0
- /package/{waibuMpa/template/_mail/user-forgot-password-link.html → bajoTemplate/template/_mail/user-activation-success.html} +0 -0
- /package/{waibuMpa/template/_mail/user-signup-success.html → bajoTemplate/template/_mail/user-forgot-password-changed.html} +0 -0
- /package/{waibuMpa → bajoTemplate}/template/help/contact-form/form.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/help/contact-form/success.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/help/trouble-tickets/add.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/help/trouble-tickets/details.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/help/trouble-tickets/list.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/info/about-us.id.md +0 -0
- /package/{waibuMpa → bajoTemplate}/template/info/about-us.md +0 -0
- /package/{waibuMpa → bajoTemplate}/template/info/cookie-policy.md +0 -0
- /package/{waibuMpa → bajoTemplate}/template/info/privacy.md +0 -0
- /package/{waibuMpa → bajoTemplate}/template/info/terms-conditions.md +0 -0
- /package/{waibuMpa → bajoTemplate}/template/my-stuff/change-password.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/my-stuff/profile/edit.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/my-stuff/profile/view.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/my-stuff/reset-api-key.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/signin.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/signout.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/user/activation.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/user/forgot-password.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/user/fpl-invalid.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/user/fpl.html +0 -0
- /package/{waibuMpa → bajoTemplate}/template/user/signup/form.html +0 -0
- /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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
package/bajo/intl/en-US.json
CHANGED
|
@@ -87,11 +87,13 @@
|
|
|
87
87
|
"cat": "Category"
|
|
88
88
|
},
|
|
89
89
|
"validation": {
|
|
90
|
-
"password
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
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
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
+
<!-- include sumba.partial:/layout/sidebar.html -->
|
|
4
4
|
<c:div flex="fill column">
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
3
|
+
<!-- include sumba.partial:/layout/sidebar.html -->
|
|
4
4
|
<c:div flex="fill column">
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
10
|
+
<!-- include sumba.partial:/layout/footer.html -->
|
|
11
11
|
</c:div>
|
|
12
12
|
</c:container>
|
|
13
13
|
</c:div>
|
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
-
|
|
2
|
+
<!-- include sumba.partial:/user/signup/success-mail.md" />
|
|
3
3
|
<% } else { %>
|
|
4
|
-
|
|
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">
|
package/dobo/schema/user.json
CHANGED
package/package.json
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
|
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
|
}
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|