mirror of
https://github.com/dreamhunter2333/cloudflare_temp_email.git
synced 2026-09-06 16:07:14 +08:00
feat: |Worker| multi language add messages (#586)
This commit is contained in:
@@ -18,6 +18,7 @@ const messages: LocaleMessages = {
|
|||||||
NewAddressAnonymousDisabledMsg: "New address for anonymous user is disabled, please contact the administrator",
|
NewAddressAnonymousDisabledMsg: "New address for anonymous user is disabled, please contact the administrator",
|
||||||
FailedCreateAddressMsg: "Failed to create address",
|
FailedCreateAddressMsg: "Failed to create address",
|
||||||
InvalidAddressMsg: "Invalid address",
|
InvalidAddressMsg: "Invalid address",
|
||||||
|
InvalidAddressCredentialMsg: "Invalid address credential",
|
||||||
UserDeleteEmailDisabledMsg: "User delete address/email is disabled, please contact the administrator",
|
UserDeleteEmailDisabledMsg: "User delete address/email is disabled, please contact the administrator",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,6 @@ export type LocaleMessages = {
|
|||||||
NewAddressAnonymousDisabledMsg: string
|
NewAddressAnonymousDisabledMsg: string
|
||||||
FailedCreateAddressMsg: string
|
FailedCreateAddressMsg: string
|
||||||
InvalidAddressMsg: string
|
InvalidAddressMsg: string
|
||||||
|
InvalidAddressCredentialMsg: string
|
||||||
UserDeleteEmailDisabledMsg: string
|
UserDeleteEmailDisabledMsg: string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ const messages: LocaleMessages = {
|
|||||||
NewAddressAnonymousDisabledMsg: "匿名用户新建邮箱地址已禁用, 请联系管理员",
|
NewAddressAnonymousDisabledMsg: "匿名用户新建邮箱地址已禁用, 请联系管理员",
|
||||||
FailedCreateAddressMsg: "创建邮箱地址失败",
|
FailedCreateAddressMsg: "创建邮箱地址失败",
|
||||||
InvalidAddressMsg: "无效的邮箱地址",
|
InvalidAddressMsg: "无效的邮箱地址",
|
||||||
|
InvalidAddressCredentialMsg: "无效的邮箱地址凭证",
|
||||||
UserDeleteEmailDisabledMsg: "用户删除邮箱/邮件已禁用, 请联系管理员",
|
UserDeleteEmailDisabledMsg: "用户删除邮箱/邮件已禁用, 请联系管理员",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -130,7 +130,15 @@ app.use('/api/*', async (c, next) => {
|
|||||||
) {
|
) {
|
||||||
await checkoutUserRolePayload(c);
|
await checkoutUserRolePayload(c);
|
||||||
}
|
}
|
||||||
return jwt({ secret: c.env.JWT_SECRET, alg: "HS256" })(c, next);
|
|
||||||
|
try {
|
||||||
|
return await jwt({ secret: c.env.JWT_SECRET, alg: "HS256" })(c, next);
|
||||||
|
} catch (e) {
|
||||||
|
console.warn(e);
|
||||||
|
const lang = c.get("lang") || c.env.DEFAULT_LANG;
|
||||||
|
const msgs = i18n.getMessages(lang);
|
||||||
|
return c.text(msgs.InvalidAddressCredentialMsg, 401)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
// user_api auth
|
// user_api auth
|
||||||
app.use('/user_api/*', async (c, next) => {
|
app.use('/user_api/*', async (c, next) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user