fix: admin role change, logo access, magic link validation, login help
- Add updateTeamMemberRole mutation for admins to change team member roles - Allow any team member (not just lead) to change project logo - Add visible "Add logo"/"Change" label under logo for discoverability - Pre-check email existence before sending magic link (show error) - Add "forgot which email" contact link on login page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
26
src/app/api/auth/check-email/route.ts
Normal file
26
src/app/api/auth/check-email/route.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { NextRequest, NextResponse } from 'next/server'
|
||||
import { prisma } from '@/lib/prisma'
|
||||
|
||||
/**
|
||||
* Pre-check whether an email exists before sending a magic link.
|
||||
* This is a closed platform (no self-registration) so revealing
|
||||
* email existence is acceptable and helps users who mistype.
|
||||
*/
|
||||
export async function POST(req: NextRequest) {
|
||||
try {
|
||||
const { email } = await req.json()
|
||||
if (!email || typeof email !== 'string') {
|
||||
return NextResponse.json({ exists: false }, { status: 400 })
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { email: email.toLowerCase().trim() },
|
||||
select: { status: true },
|
||||
})
|
||||
|
||||
const exists = !!user && user.status !== 'SUSPENDED'
|
||||
return NextResponse.json({ exists })
|
||||
} catch {
|
||||
return NextResponse.json({ exists: false }, { status: 500 })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user