Update sealious to get the new i18n api
This commit is contained in:
parent
9a154db1e8
commit
6bc0653072
44
package-lock.json
generated
44
package-lock.json
generated
@ -43,7 +43,7 @@
|
||||
"nyc": "^17.1.0",
|
||||
"object-path": "^0.11.8",
|
||||
"qs": "^6.12.0",
|
||||
"sealious": "^0.21.23",
|
||||
"sealious": "^0.21.30",
|
||||
"slug": "^9.1.0",
|
||||
"stimulus": "^3.2.2",
|
||||
"tempstream": "^0.4.6",
|
||||
@ -2969,15 +2969,6 @@
|
||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
|
||||
},
|
||||
"node_modules/boom": {
|
||||
"version": "7.3.0",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-7.3.0.tgz",
|
||||
"integrity": "sha512-Swpoyi2t5+GhOEGw8rEsKvTxFLIDiiKoUc2gsoV6Lyr43LHBIzch3k2MvYUs8RTROrIkVJ3Al0TkaOGjnb+B6A==",
|
||||
"deprecated": "This module has moved and is now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.",
|
||||
"dependencies": {
|
||||
"hoek": "6.x.x"
|
||||
}
|
||||
},
|
||||
"node_modules/brace-expansion": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
@ -6852,12 +6843,6 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/hoek": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-6.1.3.tgz",
|
||||
"integrity": "sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ==",
|
||||
"deprecated": "This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues."
|
||||
},
|
||||
"node_modules/hookable": {
|
||||
"version": "5.5.3",
|
||||
"resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
|
||||
@ -12031,9 +12016,9 @@
|
||||
"peer": true
|
||||
},
|
||||
"node_modules/sealious": {
|
||||
"version": "0.21.23",
|
||||
"resolved": "https://registry.npmjs.org/sealious/-/sealious-0.21.23.tgz",
|
||||
"integrity": "sha512-Vl/Ms+L00ucjEl8/eE4+otLMrWaeVgspn1xCRT4SXh+dRz9DID84ydspqVpyyUf7hUiHuX8zlfdn1FwgCQ0lPQ==",
|
||||
"version": "0.21.30",
|
||||
"resolved": "https://registry.npmjs.org/sealious/-/sealious-0.21.30.tgz",
|
||||
"integrity": "sha512-EWmqqFpDdgMvBmqAnaoX3FN2TmWdEgA1MgCUoQNB0iwUSl5m2Ghpd3W3eoM4H0Nr6bTr1ogJaOsAZJJFlIdc0Q==",
|
||||
"dependencies": {
|
||||
"@koa/router": "^12.0.1",
|
||||
"@sealcode/file-manager": "^1.0.1",
|
||||
@ -12055,7 +12040,6 @@
|
||||
"@types/object-hash": "^1.3.3",
|
||||
"@types/sanitize-html": "^2.11.0",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"boom": "^7.3.0",
|
||||
"chalk": "^4.1.0",
|
||||
"clone": "^1.0.2",
|
||||
"color": "latest",
|
||||
@ -17220,14 +17204,6 @@
|
||||
"resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
|
||||
"integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww=="
|
||||
},
|
||||
"boom": {
|
||||
"version": "7.3.0",
|
||||
"resolved": "https://registry.npmjs.org/boom/-/boom-7.3.0.tgz",
|
||||
"integrity": "sha512-Swpoyi2t5+GhOEGw8rEsKvTxFLIDiiKoUc2gsoV6Lyr43LHBIzch3k2MvYUs8RTROrIkVJ3Al0TkaOGjnb+B6A==",
|
||||
"requires": {
|
||||
"hoek": "6.x.x"
|
||||
}
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz",
|
||||
@ -20026,11 +20002,6 @@
|
||||
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.7.3.tgz",
|
||||
"integrity": "sha512-tzcUFauisWKNHaRkN4Wjl/ZA07gENAjFl3J/c480dprkGTg5EQstgaNFqBfUqCq54kZRIEcreTsAgF/m2quD7A=="
|
||||
},
|
||||
"hoek": {
|
||||
"version": "6.1.3",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-6.1.3.tgz",
|
||||
"integrity": "sha512-YXXAAhmF9zpQbC7LEcREFtXfGq5K1fmd+4PHkBq8NUqmzW3G+Dq10bI/i0KucLRwss3YYFQ0fSfoxBZYiGUqtQ=="
|
||||
},
|
||||
"hookable": {
|
||||
"version": "5.5.3",
|
||||
"resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
|
||||
@ -23910,9 +23881,9 @@
|
||||
}
|
||||
},
|
||||
"sealious": {
|
||||
"version": "0.21.23",
|
||||
"resolved": "https://registry.npmjs.org/sealious/-/sealious-0.21.23.tgz",
|
||||
"integrity": "sha512-Vl/Ms+L00ucjEl8/eE4+otLMrWaeVgspn1xCRT4SXh+dRz9DID84ydspqVpyyUf7hUiHuX8zlfdn1FwgCQ0lPQ==",
|
||||
"version": "0.21.30",
|
||||
"resolved": "https://registry.npmjs.org/sealious/-/sealious-0.21.30.tgz",
|
||||
"integrity": "sha512-EWmqqFpDdgMvBmqAnaoX3FN2TmWdEgA1MgCUoQNB0iwUSl5m2Ghpd3W3eoM4H0Nr6bTr1ogJaOsAZJJFlIdc0Q==",
|
||||
"requires": {
|
||||
"@koa/router": "^12.0.1",
|
||||
"@sealcode/file-manager": "^1.0.1",
|
||||
@ -23934,7 +23905,6 @@
|
||||
"@types/object-hash": "^1.3.3",
|
||||
"@types/sanitize-html": "^2.11.0",
|
||||
"@types/uuid": "^8.3.0",
|
||||
"boom": "^7.3.0",
|
||||
"chalk": "^4.1.0",
|
||||
"clone": "^1.0.2",
|
||||
"color": "latest",
|
||||
|
@ -116,7 +116,7 @@
|
||||
"nyc": "^17.1.0",
|
||||
"object-path": "^0.11.8",
|
||||
"qs": "^6.12.0",
|
||||
"sealious": "^0.21.23",
|
||||
"sealious": "^0.21.30",
|
||||
"slug": "^9.1.0",
|
||||
"stimulus": "^3.2.2",
|
||||
"tempstream": "^0.4.6",
|
||||
|
@ -16,14 +16,14 @@ export default async function PasswordResetTemplate(
|
||||
|
||||
const username = matching_users.items[0]?.get("username");
|
||||
|
||||
const context = new app.Context();
|
||||
return EmailTemplates.Simple(app, {
|
||||
subject: app.i18n("password_reset_email_subject", [app.manifest.name]),
|
||||
subject: context.i18n`[${app.manifest.name}] Password reset request`,
|
||||
to: `${String(username)}<${email_address}>`,
|
||||
text: `
|
||||
${app.i18n("password_reset_email_text", [app.manifest.name, username])}`,
|
||||
text: `Hello, ${username}. Someone requested a password reset on your account on ${app.manifest.name}. If it was you, use the link below to change the password. Otherwise, ignore this message.`,
|
||||
buttons: [
|
||||
{
|
||||
text: app.i18n("password_reset_cta"),
|
||||
text: context.i18n`Change password`,
|
||||
href: `${app.manifest.base_url}/confirm-password-reset?token=${token}&email=${email_address}`,
|
||||
},
|
||||
],
|
||||
|
@ -5,14 +5,14 @@ export default async function RegistrationIntentTemplate(
|
||||
app: App,
|
||||
{ email_address, token }: { email_address: string; token: string }
|
||||
) {
|
||||
const context = new app.Context();
|
||||
return EmailTemplates.Simple(app, {
|
||||
subject: app.i18n("registration_intent_email_subject", [app.manifest.name]),
|
||||
subject: context.i18n`Finish creating your ${app.manifest.name} account`,
|
||||
to: email_address,
|
||||
text: `
|
||||
${app.i18n("registration_intent_email_text", [app.manifest.name])}`,
|
||||
text: `To finish setting up your account, click the following link:`,
|
||||
buttons: [
|
||||
{
|
||||
text: app.i18n("registration_intent_cta"),
|
||||
text: context.i18n`To finish setting up your account, click the following link:`,
|
||||
href: `${app.manifest.base_url}/account/confirm-registration-email?token=${token}&email=${email_address}`,
|
||||
},
|
||||
],
|
||||
|
@ -37,18 +37,16 @@ export class Roles extends Policy {
|
||||
|
||||
async checkerFunction(context: Context) {
|
||||
if (context.user_id === null) {
|
||||
return Policy.deny(context.app.i18n("policy_logged_in_deny"));
|
||||
return Policy.deny(context.i18n`You are not logged in`);
|
||||
}
|
||||
const matching_roles_count = await this.countMatchingRoles(context);
|
||||
|
||||
return matching_roles_count > 0
|
||||
? Policy.allow(
|
||||
context.app.i18n("policy_roles_allow", [
|
||||
this.allowed_roles.join(", "),
|
||||
])
|
||||
context.i18n`You are assigned to one of these roles: ${this.allowed_roles.join(", ")}`
|
||||
)
|
||||
: Policy.deny(
|
||||
context.app.i18n("policy_roles_deny", [this.allowed_roles.join(", ")])
|
||||
context.i18n`You are not assigned to one of these roles: ${this.allowed_roles.join(", ")}`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user