validate Google identity claims
This commit is contained in:
+3
-1
@@ -94,7 +94,9 @@ export async function loginWithGoogle(credential) {
|
|||||||
);
|
);
|
||||||
if (p.aud !== clientId) throw new Error('aud eşleşmiyor');
|
if (p.aud !== clientId) throw new Error('aud eşleşmiyor');
|
||||||
if (p.email_verified !== 'true' && p.email_verified !== true) throw new Error('e-posta doğrulanmamış');
|
if (p.email_verified !== 'true' && p.email_verified !== true) throw new Error('e-posta doğrulanmamış');
|
||||||
const email = String(p.email).toLowerCase();
|
if (typeof p.sub !== 'string' || !p.sub.trim()) throw new Error('Google kullanıcı kimliği eksik');
|
||||||
|
if (typeof p.email !== 'string' || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p.email)) throw new Error('Geçerli e-posta eksik');
|
||||||
|
const email = p.email.toLowerCase();
|
||||||
const isAdmin = isAdminEmail(email);
|
const isAdmin = isAdminEmail(email);
|
||||||
const user = {
|
const user = {
|
||||||
email,
|
email,
|
||||||
|
|||||||
Reference in New Issue
Block a user