feat: add support for OAuth-only login mode and update configuration handling

This commit is contained in:
Linus Rath
2026-03-12 22:05:29 +01:00
parent ae29e64197
commit b090bf6d52
5 changed files with 49 additions and 1 deletions
+4
View File
@@ -14,6 +14,10 @@ const COOKIE_OPTIONS = {
export async function POST(request: NextRequest) {
try {
if (process.env.OAUTH_ENABLED === 'true' && process.env.OAUTH_ONLY === 'true') {
return NextResponse.json({ error: 'Basic authentication is disabled' }, { status: 403 });
}
const { serverUrl, username, password } = await request.json();
if (!serverUrl || !username || !password) {
return NextResponse.json({ error: 'Missing required fields' }, { status: 400 });
+1
View File
@@ -19,6 +19,7 @@ export async function GET() {
appName: process.env.APP_NAME || process.env.NEXT_PUBLIC_APP_NAME || 'Webmail',
jmapServerUrl: process.env.JMAP_SERVER_URL || process.env.NEXT_PUBLIC_JMAP_SERVER_URL || '',
oauthEnabled: process.env.OAUTH_ENABLED === 'true',
oauthOnly: process.env.OAUTH_ENABLED === 'true' && process.env.OAUTH_ONLY === 'true',
oauthClientId: process.env.OAUTH_CLIENT_ID || '',
oauthIssuerUrl: process.env.OAUTH_ISSUER_URL || '',
rememberMeEnabled: !!process.env.SESSION_SECRET,