///
// The account emails were in English, and pointed at PocketBase's admin console.
//
// **Why it matters here.** Every other surface of this app is Czech, on purpose:
// the people using it are the owner's parents and his children. The one moment
// they are most likely to be stuck — locked out, asking for a new password — was
// the one moment the product started speaking English and sent them to
// `pb.petruzalekr.cz/_/#/auth/confirm-password-reset/…`, which is the admin UI's
// own page and reads to anybody's parent like a developer tool opened by
// mistake.
//
// Found by looking at a delivered message rather than at the settings: the
// templates were simply PocketBase's defaults, and defaults are invisible until
// somebody receives one.
//
// The links now point at amber.petruzalekr.cz, which hosts the confirm form in
// Czech (see pb_public/index.html, `?reset=`). Verification and email-change
// keep PocketBase's own confirm pages: nobody has hit those yet, they are not
// part of the reported problem, and pointing them somewhere that does not exist
// would be worse than English.
const RESET_SUBJECT = "Nové heslo k Amberu";
const RESET_BODY = `
Ahoj,
Někdo (snad ty) požádal o nové heslo k Amberu. Nastavíš si ho tímhle odkazem:
Nastavit nové heslo
Pokud jsi o nic nežádal, tenhle e-mail klidně smaž. Nic se nestalo a heslo
zůstává, jaké bylo.
Amber
`;
const VERIFY_SUBJECT = "Ověření e-mailu pro Amber";
const VERIFY_BODY = `Ahoj,
Potvrď prosím tímhle odkazem, že tenhle e-mail patří tobě:
Potvrdit e-mail
Amber
`;
const CHANGE_SUBJECT = "Změna e-mailu u Amberu";
const CHANGE_BODY = `Ahoj,
Potvrď prosím změnu e-mailu u svého účtu:
Potvrdit změnu
Pokud jsi o změnu nežádal, ozvi se Richardovi — někdo se ti hrabe v účtu.
Amber
`;
// The defaults, so the down migration restores exactly what was there.
const EN = {
reset: {
subject: "Reset your {APP_NAME} password",
body: `Hello,
Click on the button below to reset your password.
Reset password
If you didn't ask to reset your password, please ignore this email.
Thanks,
{APP_NAME} team
`,
},
};
migrate(
(app) => {
const users = app.findCollectionByNameOrId("users");
users.resetPasswordTemplate.subject = RESET_SUBJECT;
users.resetPasswordTemplate.body = RESET_BODY;
users.verificationTemplate.subject = VERIFY_SUBJECT;
users.verificationTemplate.body = VERIFY_BODY;
users.confirmEmailChangeTemplate.subject = CHANGE_SUBJECT;
users.confirmEmailChangeTemplate.body = CHANGE_BODY;
app.save(users);
},
(app) => {
const users = app.findCollectionByNameOrId("users");
users.resetPasswordTemplate.subject = EN.reset.subject;
users.resetPasswordTemplate.body = EN.reset.body;
app.save(users);
},
);