Skip to content

Commit bc0a0ae

Browse files
committed
fix: email handler not working
1 parent e838f71 commit bc0a0ae

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

frontend/src/email-handler.html

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,20 @@
166166
</body>
167167
<script type="module">
168168
import $ from "jquery";
169-
import { _Auth as Auth } from "./ts/firebase";
170169
import {
171170
applyActionCode,
172171
verifyPasswordResetCode,
173172
confirmPasswordReset,
174173
checkActionCode,
175174
sendPasswordResetEmail,
176175
signInWithEmailAndPassword,
176+
getAuth,
177177
} from "firebase/auth";
178+
import { initializeApp } from "firebase/app";
179+
import { firebaseConfig } from "./ts/constants/firebase-config";
180+
181+
const app = initializeApp(firebaseConfig);
182+
const Auth = getAuth(app);
178183

179184
function isPasswordStrong(password) {
180185
const hasCapital = !!password.match(/[A-Z]/);
@@ -199,9 +204,11 @@
199204
$("main .preloader .subText").text(`You can now close this tab`);
200205
})
201206
.catch((error) => {
207+
console.error(error);
202208
$("main .preloader .icon").html(`<i class="fas fa-fw fa-times"></i>`);
203-
$("main .preloader .text").text(error.message);
204-
209+
$("main .preloader .text").text(
210+
`Fatal error: ${error.message}. If this issue persists, please report it.`
211+
);
205212
// Code is invalid or expired. Ask the user to verify their email address
206213
// again.
207214
});
@@ -255,17 +262,24 @@
255262
signInWithEmailAndPassword(Auth, accountEmail, newPassword);
256263
})
257264
.catch((error) => {
265+
console.error(error);
258266
$("main .preloader .icon").html(
259267
`<i class="fas fa-fw fa-times"></i>`
260268
);
261-
$("main .preloader .text").text(error.message);
269+
$("main .preloader .text").text(
270+
`Fatal error: ${error.message}. If this issue persists, please report it.`
271+
);
262272
// Error occurred during confirmation. The code might have expired or the
263273
// password is too weak.
264274
});
265275
})
266276
.catch((error) => {
277+
console.error(error);
267278
$("main .preloader .icon").html(`<i class="fas fa-fw fa-times"></i>`);
268-
$("main .preloader .text").text(error.message);
279+
$("main .preloader .text").text(
280+
`Fatal error: ${error.message}. If this issue persists, please report it.`
281+
);
282+
269283
// $("main .preloader .subText").text(error);
270284

271285
// Invalid or expired action code. Ask user to try to reset the password
@@ -308,6 +322,7 @@
308322
// in case the account was compromised:
309323
})
310324
.catch((error) => {
325+
console.error(error);
311326
$("main .preloader .icon").html(`<i class="fas fa-fw fa-times"></i>`);
312327
$("main .preloader .text").text(error.message);
313328
});
@@ -321,6 +336,7 @@
321336
$("main .preloader .subText").text(`Please check your inbox`);
322337
})
323338
.catch((error) => {
339+
console.error(error);
324340
$("main .preloader .icon").html(`<i class="fas fa-fw fa-times"></i>`);
325341
$("main .preloader .text").text(error.message);
326342
});

frontend/src/ts/firebase.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,3 @@ export function resetIgnoreAuthCallback(): void {
237237
}
238238

239239
export { authPromise };
240-
241-
//TODO refactor email-handler
242-
export const _Auth = Auth;

0 commit comments

Comments
 (0)