@@ -68,18 +68,46 @@ function checkRights() {
6868 Fetch Exps
6969--------------------------*/
7070
71- const errorMessages = {
72- 'auth/wrong-password' : "Incorrect password. Please try again." ,
73- 'auth/user-not-found' : "No user found with this email. Please register." ,
74- 'auth/invalid-email' : "Invalid email format. Please check your email." ,
75- 'auth/too-many-requests' : "Too many login attempts. Please try again later." ,
76- 'auth/network-request-failed' :"Network error. Please check your internet connection." ,
77- 'auth/operation-not-allowed' : "Login operation is not allowed. Please contact support." ,
78- 'auth/weak-password' : "Weak password. Please use a stronger password." ,
79- 'auth/invalid-credential' : "Invalid credentials. Please check your email and password."
71+ export const errorMessages = {
72+ 'auth/invalid-email' : "Invalid email format. Please check your email." ,
73+ 'auth/user-disabled' : "This user account has been disabled." ,
74+ 'auth/user-not-found' : "No user found with this email. Please register." ,
75+ 'auth/wrong-password' : "Incorrect password. Please try again." ,
76+ 'auth/email-already-in-use' : "This email is already registered. Please login or use a different email." ,
77+ 'auth/operation-not-allowed' : "Operation not allowed. Please enable the sign-in method in Firebase Console." ,
78+ 'auth/weak-password' : "Weak password. Please use a stronger password." ,
79+ 'auth/invalid-credential' : "Invalid credentials. Please check and try again." ,
80+ 'auth/too-many-requests' : "Too many login attempts. Please try again later." ,
81+ 'auth/network-request-failed' : "Network error. Please check your connection." ,
82+ 'auth/requires-recent-login' : "Recent login required. Please sign in again before retrying." ,
83+ 'auth/app-not-authorized' : "This app is not authorized to use Firebase Auth with this API key." ,
84+ 'auth/invalid-verification-code' :"Invalid verification code. Please retry." ,
85+ 'auth/invalid-verification-id' : "Invalid verification ID." ,
86+ 'auth/invalid-persistence-type' : "Invalid persistence type. Must be 'local', 'session', or 'none'." ,
87+ 'auth/unsupported-persistence-type' : "This browser does not support the specified persistence." ,
88+ 'auth/unauthorized-domain' : "Domain not authorized for authentication. Add it in Firebase Console." ,
89+ 'auth/invalid-action-code' : "This action code is invalid or expired." ,
90+ 'auth/expired-action-code' : "Action code has expired. Please request a new one." ,
91+ 'auth/captcha-check-failed' : "Captcha verification failed. Try again." ,
92+ 'auth/code-expired' : "SMS code has expired. Please resend the code." ,
93+ 'auth/invalid-phone-number' : "Invalid phone number format." ,
94+ 'auth/missing-phone-number' : "Phone number is required." ,
95+ 'auth/missing-verification-code' :"Verification code is missing." ,
96+ 'auth/missing-verification-id' : "Verification ID is missing." ,
97+ 'auth/session-cookie-expired' : "Session cookie expired. Please sign in again." ,
98+ 'auth/internal-error' : "An internal error occurred. Please try again later." ,
99+ 'auth/no-such-provider' : "No such sign-in provider is associated with this account." ,
100+ 'auth/account-exists-with-different-credential' :
101+ "An account already exists with the same email but different sign-in credentials." ,
102+ 'auth/invalid-oauth-provider' : "Unsupported OAuth provider." ,
103+ 'auth/popup-blocked' : "Popup was blocked by the browser." ,
104+ 'auth/popup-closed-by-user' : "Popup was closed before completing sign-in." ,
105+ 'auth/user-token-expired' : "User credential expired. Please sign in again." ,
106+ 'auth/null-user' : "No user is signed in." ,
80107} ;
81108
82109
110+
83111async function fetchExperiments ( ) {
84112 const experimentsRef = collection ( db , "experiments" ) ;
85113
@@ -102,7 +130,8 @@ async function fetchExperiments() {
102130 return experiments ;
103131
104132 } catch ( error ) {
105- console . error ( "Error fetching experiments:" , error ) ;
133+ const message = errorMessages [ error . code ] || error . message ;
134+ showModal ( "Error" , message ) ;
106135 return [ ] ;
107136 }
108137}
@@ -129,7 +158,7 @@ function fetchData(){
129158 loading . style . display = "none" ;
130159 } ) . catch ( ( err ) => {
131160 const message = errorMessages [ error . code ] || error . message ;
132- showModal ( "Login Failed " , message ) ;
161+ showModal ( "Error " , message ) ;
133162
134163 } ) ;
135164
0 commit comments