mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
Merge remote-tracking branch 'origin/release/0.20' into feat/add-otp-plugin
This commit is contained in:
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -3,8 +3,8 @@
|
|||||||
"biome.enabled": true,
|
"biome.enabled": true,
|
||||||
"editor.defaultFormatter": "biomejs.biome",
|
"editor.defaultFormatter": "biomejs.biome",
|
||||||
"editor.codeActionsOnSave": {
|
"editor.codeActionsOnSave": {
|
||||||
"source.organizeImports.biome": "explicit",
|
//"source.organizeImports.biome": "explicit",
|
||||||
"source.fixAll.biome": "explicit"
|
//"source.fixAll.biome": "explicit"
|
||||||
},
|
},
|
||||||
"typescript.preferences.importModuleSpecifier": "non-relative",
|
"typescript.preferences.importModuleSpecifier": "non-relative",
|
||||||
"typescript.preferences.autoImportFileExcludePatterns": [
|
"typescript.preferences.autoImportFileExcludePatterns": [
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ export type EmailOTPPluginOptions = {
|
|||||||
* @default false
|
* @default false
|
||||||
*/
|
*/
|
||||||
showActualErrors?: boolean;
|
showActualErrors?: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allow direct mutations (create/update) of OTP codes outside of this plugin,
|
* Allow direct mutations (create/update) of OTP codes outside of this plugin,
|
||||||
* e.g. via API or admin UI. If false, mutations are only allowed via the plugin's flows.
|
* e.g. via API or admin UI. If false, mutations are only allowed via the plugin's flows.
|
||||||
@@ -293,7 +293,7 @@ async function getValidatedCode(
|
|||||||
if (otpData.expires_at < new Date()) {
|
if (otpData.expires_at < new Date()) {
|
||||||
throw new OTPError("Code expired");
|
throw new OTPError("Code expired");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (otpData.used_at) {
|
if (otpData.used_at) {
|
||||||
throw new OTPError("Code already used");
|
throw new OTPError("Code already used");
|
||||||
}
|
}
|
||||||
@@ -316,7 +316,10 @@ async function invalidateAllUserCodes(app: App, entityName: string, email: strin
|
|||||||
function registerListeners(app: App, entityName: string) {
|
function registerListeners(app: App, entityName: string) {
|
||||||
app.emgr.onAny(
|
app.emgr.onAny(
|
||||||
(event) => {
|
(event) => {
|
||||||
if (event instanceof DatabaseEvents.MutatorInsertBefore || event instanceof DatabaseEvents.MutatorUpdateBefore) {
|
if (
|
||||||
|
event instanceof DatabaseEvents.MutatorInsertBefore ||
|
||||||
|
event instanceof DatabaseEvents.MutatorUpdateBefore
|
||||||
|
) {
|
||||||
if (event.params.entity.name === entityName) {
|
if (event.params.entity.name === entityName) {
|
||||||
throw new OTPError("Mutations of the OTP entity are not allowed");
|
throw new OTPError("Mutations of the OTP entity are not allowed");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
|
"$schema": "https://biomejs.dev/schemas/2.3.3/schema.json",
|
||||||
"assist": { "actions": { "source": { "organizeImports": "on" } } },
|
"assist": { "actions": { "source": { "organizeImports": "off" } } },
|
||||||
"vcs": {
|
"vcs": {
|
||||||
"defaultBranch": "main"
|
"defaultBranch": "main"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user