Exemple #1
0
        private  async Task ExecuteLoginCommandAsync()
        {
            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
            {
                await _pageDialogService.DisplayAlertAsync("No Internet", "Please check your internet connection and try again.", "Ok");
                return;
            }
            
            if (string.IsNullOrWhiteSpace(Email) || string.IsNullOrWhiteSpace(Password))
            {
                await _pageDialogService.DisplayAlertAsync("Error", "Please fill up username or password", "Ok");

                return;

            }

            IsSaving = true;
            string uid = await _firebaseAuth.LoginWithEmailAndPassword(Email, Password);
            if (uid != String.Empty)
            {
                Settings.UserEmail = Email;
                Settings.UID = uid;
               
                await _navigationService.NavigateAsync(PageConstants.MainTabbedPage);
                
            }
            else
            {
                await _pageDialogService.DisplayAlertAsync("Alert", "Wrong email or password", "Ok");
            }

            IsSaving = false;
        }
Exemple #2
0
        private async void LoginButton_Clicked(object sender, EventArgs e)
        {
            string token = await auth.LoginWithEmailAndPassword(viewModel.Username, viewModel.Password);

            if (token != string.Empty)
            {
                Application.Current.MainPage = new MainPage();
            }
            else
            {
                ShowError();
            }
        }
        private async void OnSubmit()
        {
            string token = await authentication.LoginWithEmailAndPassword(_email, _password);

            if (token != string.Empty)
            {
                await SecureStorage.SetAsync("firebase_token", token);

                Application.Current.MainPage = new AppShell();
                //await Shell.Current.GoToAsync("Home");
                //await Application.Current.MainPage.Navigation.PushAsync(new HomePage());
            }
        }
Exemple #4
0
        private async void LoginButton_Clicked(object sender, EventArgs e)
        {
            string token = await auth.LoginWithEmailAndPassword(viewModel.Username, viewModel.Password);

            if (token != string.Empty)
            {
                Application.Current.MainPage = new MainPage();
            }
            else
            {
                ShowError();
            }
            async void ShowError()
            {
                await DisplayAlert("Authentication Failed", "Email or password are incorrect. Try again!", "OK");
            }
        }
Exemple #5
0
        public async void LoginButton_Clicked(object sender, EventArgs e)
        {
            try
            {
                string token = await auth.LoginWithEmailAndPassword(emailEntry.Text, passwordEntry.Text);

                if (token != string.Empty)
                {
                    User u = new User();
                    u.email    = emailEntry.Text;
                    u.password = passwordEntry.Text;
                    u.uid      = auth.GetID();
                    Application.Current.MainPage = new MainPage(u);
                }
                else
                {
                    ShowError();
                }
            }
            catch (Exception ex)
            {
                await DisplayAlert("Errore", "L'email inserita è già utilizzata da un altro account", "OK");
            }
        }