sumba 2.19.0 → 2.19.1
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.
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<c:form-input name="city" label-floating col="8-lg 7-md"/>
|
|
18
18
|
<c:form-input name="zipCode" label-floating col="4-lg 5-md"/>
|
|
19
19
|
<c:form-input name="provinceState" label-floating col="6-lg"/>
|
|
20
|
-
<c:form-select-
|
|
20
|
+
<c:form-select-ext name="country" label-floating col="6-lg"/>
|
|
21
21
|
<c:form-input name="phone" label-floating col="6-lg"/>
|
|
22
22
|
<c:form-input name="website" label-floating col="6-lg"/>
|
|
23
23
|
</c:fieldset>
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
const fields = ['email', 'firstName', 'lastName', 'address1', 'address2', 'city', 'zipCode', 'provinceState', 'country', 'phone', 'website']
|
|
2
|
+
const model = 'SumbaUser'
|
|
2
3
|
|
|
3
4
|
const profile = {
|
|
4
5
|
method: ['GET', 'POST'],
|
|
5
6
|
handler: async function (req, reply) {
|
|
6
7
|
const { defaultsDeep } = this.app.lib.aneka
|
|
7
|
-
// const { attachmentCopyUploaded } = this.app.dobo
|
|
8
8
|
const { updateRecord, getRecord } = this.app.waibuDb
|
|
9
|
+
const { getSchemaExt } = this.app.waibuDb
|
|
9
10
|
const { omit, pick } = this.app.lib._
|
|
10
11
|
const { hash } = this.app.bajoExtra
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
const options = { forceNoHidden: ['token'], noHook: true, noCache: true, formatValue: true, retainOriginalValue: true }
|
|
14
|
+
const mdl = this.app.dobo.getModel(model)
|
|
15
|
+
|
|
16
|
+
const { schema } = await getSchemaExt(model, 'edit', { ...options, args: [{ req, model: mdl }] })
|
|
17
|
+
|
|
18
|
+
const resp = await getRecord({ model, req, id: req.user.id, options })
|
|
12
19
|
let form = defaultsDeep(req.body, omit(resp.data, ['password', 'salt']))
|
|
13
20
|
form.token = await hash(form.token)
|
|
14
21
|
let error
|
|
@@ -16,7 +23,7 @@ const profile = {
|
|
|
16
23
|
try {
|
|
17
24
|
const body = pick(form, fields)
|
|
18
25
|
const options = { noFlash: true, hidden: [], setField: 'profile', setFile: 'main.png', partial: true, fields }
|
|
19
|
-
const resp = await updateRecord({ req, reply, model
|
|
26
|
+
const resp = await updateRecord({ req, reply, model, id: req.user.id, body, options })
|
|
20
27
|
form = resp.data
|
|
21
28
|
req.flash('notify', req.t('profileUpdated'))
|
|
22
29
|
return reply.redirectTo('sumba:/your-stuff/profile')
|
|
@@ -24,7 +31,7 @@ const profile = {
|
|
|
24
31
|
error = err
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
|
-
return await reply.view('sumba.template:/your-stuff/profile/edit.html', { form, error })
|
|
34
|
+
return await reply.view('sumba.template:/your-stuff/profile/edit.html', { form, error, schema })
|
|
28
35
|
}
|
|
29
36
|
}
|
|
30
37
|
|
package/package.json
CHANGED