Fix permissions error on sign-in by removing unauthenticated Firestore query
This commit is contained in:
1 parent
a2630b73bd
commit
83ebab0514
1 file changed
-13
-13
@@ -1323,19 +1323,6 @@ window.sendMagicLink = async function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const usersQ = query(collection(db, 'users'), where('email', '==', email.toLowerCase()));
|
|
||||||
const usersSnap = await getDocs(usersQ);
|
|
||||||
const isExisting = !usersSnap.empty;
|
|
||||||
|
|
||||||
if (!isExisting && inviteToken && inviteFrom) {
|
|
||||||
document.getElementById('auth-card').style.display = 'none';
|
|
||||||
document.getElementById('magic-sent-card').style.display = 'block';
|
|
||||||
document.getElementById('magic-sent-email').textContent = email;
|
|
||||||
btn.disabled = false; btn.innerHTML = 'Continue with Email';
|
|
||||||
await notifyAdminOfNewUser(email, 'pending-' + email);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await fetch(`${window.STEPMATES_CONFIG.sendMagicLinkUrl}?email=${encodeURIComponent(email)}`);
|
const res = await fetch(`${window.STEPMATES_CONFIG.sendMagicLinkUrl}?email=${encodeURIComponent(email)}`);
|
||||||
const data = await res.json();
|
const data = await res.json();
|
||||||
if (!res.ok) throw new Error(data.error || 'Failed to send');
|
if (!res.ok) throw new Error(data.error || 'Failed to send');
|
||||||
|
|||||||
Reference in new issue
Block a user