feat: integrate Better Auth and enhance authentication flow
- Added Better Auth integration to the web application, allowing for dual login support with both custom and Better Auth systems. - Updated authentication client configuration to dynamically set the base URL based on the environment. - Enhanced chat components to utilize user authentication status, improving user experience and security. - Refactored various components to support Better Auth, including error handling and user identity management. - Improved notification handling and user feedback mechanisms during authentication processes.
This commit is contained in:
@@ -113,14 +113,29 @@
|
||||
showAboutModal = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* FASE 2: Login dual - tenta Better Auth primeiro, fallback para sistema customizado
|
||||
*/
|
||||
async function handleLogin(e: Event) {
|
||||
e.preventDefault();
|
||||
erroLogin = "";
|
||||
carregandoLogin = true;
|
||||
|
||||
try {
|
||||
// Usar mutation normal com WebRTC para capturar IP
|
||||
// getBrowserInfo() tenta obter o IP local via WebRTC
|
||||
// FASE 2: Por enquanto, sistema customizado funciona normalmente
|
||||
// Quando Better Auth estiver configurado, tentaremos primeiro:
|
||||
//
|
||||
// try {
|
||||
// await authStore.loginWithBetterAuth(matricula, senha);
|
||||
// closeLoginModal();
|
||||
// goto("/");
|
||||
// return;
|
||||
// } catch (betterAuthError) {
|
||||
// // Fallback para sistema customizado
|
||||
// console.log("Better Auth falhou, usando sistema customizado");
|
||||
// }
|
||||
|
||||
// Sistema customizado (atual e funcionando)
|
||||
const browserInfo = await getBrowserInfo();
|
||||
|
||||
const resultado = await convex.mutation(api.autenticacao.login, {
|
||||
|
||||
Reference in New Issue
Block a user