feat: add DISABLE_ANONYMOUS_USER_CREATE_EMAIL which only allow logi… (#545)

feat: add `DISABLE_ANONYMOUS_USER_CREATE_EMAIL` which only allow login user create email address
This commit is contained in:
Dream Hunter
2025-01-05 18:51:48 +08:00
committed by GitHub
parent e9748be9fe
commit 92620cdedb
11 changed files with 28 additions and 3 deletions

View File

@@ -103,6 +103,11 @@ api.get('/api/settings', async (c) => {
})
api.post('/api/new_address', async (c) => {
if (getBooleanValue(c.env.DISABLE_ANONYMOUS_USER_CREATE_EMAIL)
&& !c.get("userPayload")
) {
return c.text("New address for anonymous user is disabled", 403)
}
if (!getBooleanValue(c.env.ENABLE_USER_CREATE_EMAIL)) {
return c.text("New address is disabled", 403)
}