Refactor CORS header handling in authentication endpoints
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 50s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 50s
Update the CORS header variable name from 'origin' to 'requestOrigin' in both login and registration API endpoints for improved clarity and consistency. This change enhances the readability of the code while maintaining support for cross-device authentication.
This commit is contained in:
@@ -7,9 +7,9 @@ import { writeAuditLog } from '../../../utils/audit-log.js'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
// CORS-Header für Cross-Device Authentication
|
||||
const origin = getHeader(event, 'origin')
|
||||
if (origin) {
|
||||
setHeader(event, 'Access-Control-Allow-Origin', origin)
|
||||
const requestOrigin = getHeader(event, 'origin')
|
||||
if (requestOrigin) {
|
||||
setHeader(event, 'Access-Control-Allow-Origin', requestOrigin)
|
||||
setHeader(event, 'Access-Control-Allow-Credentials', 'true')
|
||||
setHeader(event, 'Access-Control-Allow-Methods', 'POST, OPTIONS')
|
||||
setHeader(event, 'Access-Control-Allow-Headers', 'Content-Type, Authorization')
|
||||
|
||||
Reference in New Issue
Block a user