Remove admin approval - users now go straight to dashboard on sign up
This commit is contained in:
+18
-25
@@ -803,42 +803,35 @@ async function initUser(user) {
|
|||||||
await setDoc(userRef, {
|
await setDoc(userRef, {
|
||||||
email: user.email,
|
email: user.email,
|
||||||
webhookToken,
|
webhookToken,
|
||||||
approved: false,
|
approved: true,
|
||||||
dailyGoal: 5000,
|
dailyGoal: 5000,
|
||||||
createdAt: serverTimestamp()
|
createdAt: serverTimestamp()
|
||||||
});
|
});
|
||||||
await setDoc(doc(db, 'profiles', user.uid), { displayName: '', avatarUrl: '' });
|
await setDoc(doc(db, 'profiles', user.uid), { displayName: user.displayName || '', avatarUrl: '🏃' });
|
||||||
await setDoc(doc(db, 'steps', user.uid), { stepsByDate: {} });
|
await setDoc(doc(db, 'steps', user.uid), { stepsByDate: {} });
|
||||||
currentUserData = { email: user.email, webhookToken, approved: false, dailyGoal: 5000 };
|
currentUserData = { email: user.email, webhookToken, approved: true, dailyGoal: 5000 };
|
||||||
await notifyAdminOfNewUser(user.email, user.uid);
|
const profileSnap = await getDoc(doc(db, 'profiles', user.uid));
|
||||||
showScreen('pending');
|
currentProfileData = profileSnap.exists() ? profileSnap.data() : {};
|
||||||
|
currentStepsData = {};
|
||||||
|
loadDashboard();
|
||||||
} else {
|
} else {
|
||||||
currentUserData = snap.data();
|
currentUserData = snap.data();
|
||||||
if (currentUserData.approved === false) {
|
if (!currentUserData.setupComplete && currentUserData.approved === false) {
|
||||||
showScreen('pending');
|
await updateDoc(userRef, { approved: true });
|
||||||
} else if (!currentUserData.setupComplete) {
|
currentUserData.approved = true;
|
||||||
const profileSnap = await getDoc(doc(db, 'profiles', user.uid));
|
|
||||||
currentProfileData = profileSnap.exists() ? profileSnap.data() : {};
|
|
||||||
const stepsSnap = await getDoc(doc(db, 'steps', user.uid));
|
|
||||||
currentStepsData = stepsSnap.exists() ? stepsSnap.data().stepsByDate || {} : {};
|
|
||||||
showScreen('onboarding');
|
|
||||||
document.getElementById('ob-webhook-url').textContent = buildWebhookUrl(currentUserData.webhookToken);
|
|
||||||
} else {
|
|
||||||
const profileSnap = await getDoc(doc(db, 'profiles', user.uid));
|
|
||||||
currentProfileData = profileSnap.exists() ? profileSnap.data() : {};
|
|
||||||
const stepsSnap = await getDoc(doc(db, 'steps', user.uid));
|
|
||||||
currentStepsData = stepsSnap.exists() ? stepsSnap.data().stepsByDate || {} : {};
|
|
||||||
loadDashboard();
|
|
||||||
const pendingCount = getPendingFriendUids().length;
|
|
||||||
if (pendingCount > 0) switchPanel('friends');
|
|
||||||
}
|
}
|
||||||
|
const profileSnap = await getDoc(doc(db, 'profiles', user.uid));
|
||||||
|
currentProfileData = profileSnap.exists() ? profileSnap.data() : {};
|
||||||
|
const stepsSnap = await getDoc(doc(db, 'steps', user.uid));
|
||||||
|
currentStepsData = stepsSnap.exists() ? stepsSnap.data().stepsByDate || {} : {};
|
||||||
|
loadDashboard();
|
||||||
|
const pendingCount = getPendingFriendUids().length;
|
||||||
|
if (pendingCount > 0) switchPanel('friends');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function notifyAdminOfNewUser(email, uid) {
|
async function notifyAdminOfNewUser(email, uid) {
|
||||||
try {
|
// Admin approval removed - auto-approval enabled
|
||||||
await fetch(`${window.STEPMATES_CONFIG.adminNotifyUrl}?uid=${uid}&email=${encodeURIComponent(email)}`);
|
|
||||||
} catch(e) { console.warn('Admin notify failed', e); }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ONBOARDING
|
// ONBOARDING
|
||||||
|
|||||||
Reference in New Issue
Block a user