sumba 1.2.0 → 1.2.2
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-contact-form@after-record-create.js +1 -1
- package/bajo/hook/dobo.sumba-user@after-record-create.js +1 -1
- package/bajo/hook/dobo.sumba-user@after-record-update.js +3 -3
- package/bajo/hook/waibu-mpa@pre-parsing.js +4 -4
- package/bajo/intl/en-US.json +3 -1
- package/bajo/intl/id.json +2 -0
- package/bajoTemplate/partial/layout/footer.html +4 -4
- package/bajoTemplate/partial/signin.html +0 -2
- package/bajoTemplate/partial/signout.html +2 -0
- package/bajoTemplate/partial/your-stuff/reset-api-key.html +1 -1
- package/index.js +1 -1
- package/package.json +4 -1
- package/waibuMpa/route/help/contact-form.js +1 -1
- package/waibuMpa/route/user/activation.js +1 -1
- package/waibuMpa/route/user/forgot-password/@fpl.js +2 -2
- package/waibuMpa/route/user/forgot-password.js +1 -1
- package/waibuMpa/route/user/signup.js +2 -2
- package/waibuMpa/route/your-stuff/change-password.js +1 -1
- package/waibuMpa/route/your-stuff/reset-api-key.js +1 -1
|
@@ -10,7 +10,7 @@ async function afterRecordCreate (body, options = {}, rec) {
|
|
|
10
10
|
const subject = options.req.t('contactForm')
|
|
11
11
|
await sendMail(
|
|
12
12
|
'sumba.template:/_mail/help-contact-form.html',
|
|
13
|
-
{ to, bcc, subject, data, options }
|
|
13
|
+
{ to, bcc, subject, data, options, source: this.name }
|
|
14
14
|
)
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -7,7 +7,7 @@ async function afterRecordCreate (body, options = {}, rec) {
|
|
|
7
7
|
const subject = options.req.t('newUserSignup')
|
|
8
8
|
await sendMail(
|
|
9
9
|
'sumba.template:/_mail/user-signup-success.html',
|
|
10
|
-
{ to, subject, data, options }
|
|
10
|
+
{ to, subject, data, options, source: this.name }
|
|
11
11
|
)
|
|
12
12
|
}
|
|
13
13
|
|
|
@@ -10,19 +10,19 @@ async function afterRecordUpdate (id, body, options = {}, rec) {
|
|
|
10
10
|
subject = options.req.t('userActivation')
|
|
11
11
|
await sendMail(
|
|
12
12
|
'sumba.template:/_mail/user-activation-success.html',
|
|
13
|
-
{ to, subject, data, options }
|
|
13
|
+
{ to, subject, data, options, source: this.name }
|
|
14
14
|
)
|
|
15
15
|
} else if (oldData.token !== data.token) {
|
|
16
16
|
subject = options.req.t('resetApiKey')
|
|
17
17
|
await sendMail(
|
|
18
18
|
'sumba.template:/_mail/mystuff-reset-api-key.html',
|
|
19
|
-
{ to, subject, data, options }
|
|
19
|
+
{ to, subject, data, options, source: this.name }
|
|
20
20
|
)
|
|
21
21
|
} else if (body.password) {
|
|
22
22
|
subject = options.req.t('changePassword')
|
|
23
23
|
await sendMail(
|
|
24
24
|
'sumba.template:/_mail/mystuff-change-password.html',
|
|
25
|
-
{ to, subject, data, options }
|
|
25
|
+
{ to, subject, data, options, source: this.name }
|
|
26
26
|
)
|
|
27
27
|
}
|
|
28
28
|
}
|
|
@@ -15,8 +15,8 @@ const preParsing = {
|
|
|
15
15
|
req.menu = req.menu ?? {}
|
|
16
16
|
if (req.user) {
|
|
17
17
|
req.menu.user = [
|
|
18
|
-
{ value: routePath('sumba:/change-password', req), text: req.t('Change Password') },
|
|
19
|
-
{ value: routePath('sumba:/profile', req), text: req.t('yourProfile') },
|
|
18
|
+
{ value: routePath('sumba:/your-stuff/change-password', req), text: req.t('Change Password') },
|
|
19
|
+
{ value: routePath('sumba:/your-stuff/profile', req), text: req.t('yourProfile') },
|
|
20
20
|
'-',
|
|
21
21
|
{ value: routePath('sumba:/signout', req), text: req.t('signout') }
|
|
22
22
|
]
|
|
@@ -24,8 +24,8 @@ const preParsing = {
|
|
|
24
24
|
req.menu.user = [
|
|
25
25
|
{ value: routePath('sumba:/signin', req), text: req.t('signin') },
|
|
26
26
|
'-',
|
|
27
|
-
{ value: routePath('sumba:/signup', req), text: req.t('signup') },
|
|
28
|
-
{ value: routePath('sumba:/forgot-password', req), text: req.t('forgotPassword') }
|
|
27
|
+
{ value: routePath('sumba:/user/signup', req), text: req.t('signup') },
|
|
28
|
+
{ value: routePath('sumba:/user/forgot-password', req), text: req.t('forgotPassword') }
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
31
|
}
|
package/bajo/intl/en-US.json
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"aboutUs": "About Us",
|
|
36
36
|
"invalidActivationKey": "Invalid activation key",
|
|
37
37
|
"signoutNow": "Yes, sign me out now",
|
|
38
|
-
"signoutWarning": "You
|
|
38
|
+
"signoutWarning": "You're about to sign out. This means your session will be cleared and you'll be asked for your credential again in case you want to access any protected pages and resources.<br /><br />Are your sure?",
|
|
39
39
|
"clearInvalidKey": "Clear Invalid Fields",
|
|
40
40
|
"linkPasswordWillbeSent": "Link to reset password will be sent to your email",
|
|
41
41
|
"signinSuccessfully": "You've successfully signed in",
|
|
@@ -103,6 +103,8 @@
|
|
|
103
103
|
"unknownUser": "User Unknown/Invalid",
|
|
104
104
|
"socialMedia": "Social Media",
|
|
105
105
|
"resetPassword": "Reset Password",
|
|
106
|
+
"contactFormSubmitted": "Contact form successfully submitted",
|
|
107
|
+
"currentApiKey": "Current API Key",
|
|
106
108
|
"field": {
|
|
107
109
|
"currentPassword": "Current Password",
|
|
108
110
|
"newPassword": "New Password",
|
package/bajo/intl/id.json
CHANGED
|
@@ -104,6 +104,8 @@
|
|
|
104
104
|
"unknownUser": "Pengguna Tidak Dikenal/Tidak Valid",
|
|
105
105
|
"socialMedia": "Media Sosial",
|
|
106
106
|
"resetPassword": "Reset Kata Sandi",
|
|
107
|
+
"contactFormSubmitted": "Form kontak sukses dikirim",
|
|
108
|
+
"currentApiKey": "Kunci API Saat Ini",
|
|
107
109
|
"field": {
|
|
108
110
|
"currentPassword": "Kata Sandi Saat Ini",
|
|
109
111
|
"newPassword": "Kata Sandi Baru",
|
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
<c:div id="footer"></c:div>
|
|
3
3
|
<small>
|
|
4
4
|
<c:nav flex="justify-content:center" tag="ul">
|
|
5
|
-
<% if (!(_meta.routeOpts.pathSrc.startsWith('/
|
|
5
|
+
<% if (!(_meta.routeOpts.pathSrc.startsWith('/your-stuff') || _meta.routeOpts.pathSrc.startsWith('/info') ||
|
|
6
6
|
_meta.routeOpts.pathSrc.startsWith('/help'))) { %>
|
|
7
7
|
<c:nav-dropdown-darkmode padding="x-2"/>
|
|
8
8
|
<c:nav-dropdown-language padding="x-2"/>
|
|
9
9
|
<c:nav-divider />
|
|
10
10
|
<% } %>
|
|
11
|
-
<c:nav-item t:content="cookie" href="sumba:/info
|
|
12
|
-
<c:nav-item t:content="privacy" href="sumba:/info
|
|
13
|
-
<c:nav-item t:content="terms" href="sumba:/info
|
|
11
|
+
<c:nav-item t:content="cookie" href="sumba:/info/:item|cookie-policy" padding="x-1"/>
|
|
12
|
+
<c:nav-item t:content="privacy" href="sumba:/info/:item|privacy" padding="x-1"/>
|
|
13
|
+
<c:nav-item t:content="terms" href="sumba:/info/:item|terms-conditions" padding="x-2"/>
|
|
14
14
|
</c:nav>
|
|
15
15
|
</small>
|
|
16
16
|
</c:footer>
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<c:form-input name="username" label-floating wrapper-margin="bottom-2" />
|
|
3
3
|
<c:form-password name="password" label-floating wrapper-margin="bottom-3" />
|
|
4
4
|
</c:form>
|
|
5
|
-
<% if (!page.noLinks) { %>
|
|
6
5
|
<c:div move-to="#footer" flex="justify-content:center">
|
|
7
6
|
<c:nav type="inline">
|
|
8
7
|
<!-- include sumba.partial:/list-item/forgot-password.html -->
|
|
@@ -10,4 +9,3 @@
|
|
|
10
9
|
<!-- include sumba.partial:/list-item/goto-home.html -->
|
|
11
10
|
</c:nav>
|
|
12
11
|
</c:div>
|
|
13
|
-
<% } %>
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
<% if (!page.noLinks) { %>
|
|
6
6
|
<c:div move-to="#footer" flex="justify-content:center">
|
|
7
7
|
<c:nav type="inline">
|
|
8
|
+
<!-- include sumba.partial:/list-item/your-profile.html -->
|
|
9
|
+
<!-- include sumba.partial:/list-item/change-password.html -->
|
|
8
10
|
<!-- include sumba.partial:/list-item/goto-home.html -->
|
|
9
11
|
</c:nav>
|
|
10
12
|
</c:div>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<c:grid-row>
|
|
2
2
|
<c:grid-col col="6-md">
|
|
3
3
|
<c:form button reset-validation>
|
|
4
|
-
<c:form-plaintext name="apiKey" label-floating wrapper-margin="bottom-2" />
|
|
4
|
+
<c:form-plaintext name="apiKey" label-floating wrapper-margin="bottom-2" t:label="currentApiKey"/>
|
|
5
5
|
<c:form-password name="password" label-floating wrapper-margin="bottom-3" />
|
|
6
6
|
</c:form>
|
|
7
7
|
</c:grid-col>
|
package/index.js
CHANGED
|
@@ -53,7 +53,7 @@ async function factory (pkgName) {
|
|
|
53
53
|
children: [
|
|
54
54
|
// anonymous only
|
|
55
55
|
{ title: 'signin', href: 'sumba:/signin', visible: 'anon' },
|
|
56
|
-
{ title: 'forgotPassword', href: 'sumba:/forgot-password', visible: 'anon' },
|
|
56
|
+
{ title: 'forgotPassword', href: 'sumba:/user/forgot-password', visible: 'anon' },
|
|
57
57
|
{ title: 'newUserSignup', href: 'sumba:/user/signup', visible: 'anon' },
|
|
58
58
|
{ title: '-', visible: 'anon' },
|
|
59
59
|
{ title: 'activation', href: 'sumba:/user/activation', visible: 'anon' },
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sumba",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"description": "Bajo Framework's Biz Suite",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
|
+
"bajo": {
|
|
11
|
+
"type": "plugin"
|
|
12
|
+
},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
15
|
"url": "git+https://github.com/ardhi/sumba.git"
|
|
@@ -11,7 +11,7 @@ const contactForm = {
|
|
|
11
11
|
if (req.method === 'POST') {
|
|
12
12
|
try {
|
|
13
13
|
const { data } = await recordCreate({ model: 'SumbaContactForm', req, reply, options: { noFlash: true } })
|
|
14
|
-
req.flash('notify', '
|
|
14
|
+
req.flash('notify', req.t('contactFormSubmitted'))
|
|
15
15
|
return reply.view('sumba.template:/help/contact-form/success.html', { form: req.body, data })
|
|
16
16
|
} catch (err) {
|
|
17
17
|
error = err
|
|
@@ -12,7 +12,7 @@ const userActivation = {
|
|
|
12
12
|
const query = { status: 'UNVERIFIED', token: req.body.key }
|
|
13
13
|
const result = await recordFind(model, { query, limit: 1 })
|
|
14
14
|
if (result.length === 0) throw this.error('validationError', { details: [{ field: 'key', error: 'invalidActivationKey' }] })
|
|
15
|
-
await recordUpdate(model, result[0].id, { status: 'ACTIVE' }, { noValidation: true, noFlash: true })
|
|
15
|
+
await recordUpdate(model, result[0].id, { status: 'ACTIVE' }, { req, noValidation: true, noFlash: true })
|
|
16
16
|
req.flash('notify', req.t('userActivated'))
|
|
17
17
|
return reply.redirectTo(this.config.redirect.signin, req)
|
|
18
18
|
} catch (err) {
|
|
@@ -42,13 +42,13 @@ const forgotPasswordLink = {
|
|
|
42
42
|
} catch (err) {
|
|
43
43
|
throw this.error('validationError', { details: err.details, values: err.values, ns: this.name, statusCode: 422, code: 'DB_VALIDATION' })
|
|
44
44
|
}
|
|
45
|
-
await recordUpdate(model, user.id, { password: req.body.newPassword }, {
|
|
45
|
+
await recordUpdate(model, user.id, { password: req.body.newPassword }, { noFlash: true })
|
|
46
46
|
const to = `${user.firstName} ${user.lastName} <${user.email}>`
|
|
47
47
|
const subject = req.t('forgotPasswordChanged')
|
|
48
48
|
const options = { req, reply, tpl: '' }
|
|
49
49
|
await sendMail(
|
|
50
50
|
'sumba.template:/_mail/user-forgot-password-changed.html',
|
|
51
|
-
{ to, subject, data: user, options }
|
|
51
|
+
{ to, subject, data: user, options, source: this.name }
|
|
52
52
|
)
|
|
53
53
|
req.flash('notify', req.t('passwordChangedReSignin'))
|
|
54
54
|
return reply.redirectTo(this.config.redirect.signin)
|
|
@@ -24,7 +24,7 @@ const profile = {
|
|
|
24
24
|
data._meta = { hostHeader: req.headers.host }
|
|
25
25
|
await sendMail(
|
|
26
26
|
'sumba.template:/_mail/user-forgot-password-link.html',
|
|
27
|
-
{ to, subject, data, options }
|
|
27
|
+
{ to, subject, data, options, source: this.name }
|
|
28
28
|
)
|
|
29
29
|
req.flash('notify', req.t('emailSent'))
|
|
30
30
|
return reply.redirectTo(this.config.redirect.signin)
|
|
@@ -23,8 +23,8 @@ const signup = {
|
|
|
23
23
|
const fields = ['username', 'password', 'verifyPassword', 'email', 'firstName', 'lastName', 'agree']
|
|
24
24
|
const validation = { ns: ['sumba', 'dobo'], fields, extFields }
|
|
25
25
|
req.body.token = generateId()
|
|
26
|
-
const { data } = await recordCreate({ model: 'SumbaUser', req, reply, options: { validation, noFlash: true } })
|
|
27
|
-
req.flash('notify', 'userCreated')
|
|
26
|
+
const { data } = await recordCreate({ model: 'SumbaUser', req, reply, options: { validation, noFlash: true, forceNoHidden: true } })
|
|
27
|
+
req.flash('notify', req.t('userCreated'))
|
|
28
28
|
return reply.view('sumba.template:/user/signup/success.html', { form: req.body, data })
|
|
29
29
|
} catch (err) {
|
|
30
30
|
error = err
|
|
@@ -29,7 +29,7 @@ const profile = {
|
|
|
29
29
|
if (!verified) throw this.error('invalidCurrentPassword', { details: [{ field: 'currentPassword', error: 'invalidPassword' }], statusCode: 400 })
|
|
30
30
|
await recordUpdate(model, req.user.id, { password: req.body.newPassword }, { req, reply, noFlash: true })
|
|
31
31
|
// signout and redirect to signin
|
|
32
|
-
req.session.
|
|
32
|
+
req.session.userId = null
|
|
33
33
|
req.flash('notify', req.t('passwordChangedReSignin'))
|
|
34
34
|
return reply.redirectTo(this.config.redirect.signin)
|
|
35
35
|
} catch (err) {
|
|
@@ -25,7 +25,7 @@ const resetApiKey = {
|
|
|
25
25
|
const rec = await recordGet(model, req.user.id, { forceNoHidden: true })
|
|
26
26
|
const verified = await bcrypt.compare(req.body.password, rec.password)
|
|
27
27
|
if (!verified) throw this.error('validationError', { details: [{ field: 'password', error: 'invalidPassword' }], statusCode: 400 })
|
|
28
|
-
await recordUpdate(model, req.user.id, { salt: generateId() }, { req, reply, noFlash: true })
|
|
28
|
+
await recordUpdate(model, req.user.id, { salt: generateId() }, { req, reply, noFlash: true, forceNoHidden: true })
|
|
29
29
|
await delay(2000) // ensure req.user cache is expired
|
|
30
30
|
req.flash('notify', req.t('resetApiKeySuccessfull'))
|
|
31
31
|
return reply.redirectTo('sumba:/your-stuff/profile')
|