Guilhermes

This commit is contained in:
Guilherme Gaspar
2026-03-23 17:42:36 +00:00
parent 2f1935bf94
commit 44f456eb29
57 changed files with 1916 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
using GuilhermesApp.Helpers;
namespace GuilhermesApp.Pages;
public partial class LoginPage : ContentPage
{
private FirebaseService _firebaseService = new FirebaseService();
public LoginPage()
{
InitializeComponent();
}
private async void OnLoginClicked(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(EmailEntry.Text) || string.IsNullOrWhiteSpace(PasswordEntry.Text))
{
await DisplayAlert("Erro", "Preenche o email e a password.", "OK");
return;
}
try
{
// Tenta fazer o login no Firebase
var user = await _firebaseService.AuthClient.SignInWithEmailAndPasswordAsync(EmailEntry.Text, PasswordEntry.Text);
// Se correr bem, vai para a página de Perfil
// O "//" define a HomePage como a nova raiz e impede de voltar atrás
await Shell.Current.GoToAsync("//MainTabs");
}
catch (Exception)
{
await DisplayAlert("Erro", "Login falhou. Verifica as credenciais.", "OK");
}
}
private async void OnRegisterClicked(object sender, EventArgs e)
{
// Vai para a página de registo
await Shell.Current.GoToAsync(nameof(RegisterPage));
}
}