Пример #1
0
        private async void Reset_Pass(object sender, EventArgs e)
        {
            if (email.Text == "")
            {
                email.BorderColor = Color.Red;
                await DisplayAlert("Error", "Missing fields", "Okay");
            }
            else
            {
                loading.IsVisible = true;
                FirebaseAuthResponseModel res = new FirebaseAuthResponseModel()
                {
                };
                res = await DependencyService.Get <iFirebaseAuth>().ResetPassword(email.Text);

                if (res.Status == true)
                {
                    await DisplayAlert("Success", res.Response, "Okay");

                    await Navigation.PopModalAsync();
                }
                else
                {
                    await DisplayAlert("Error", res.Response, "Okay");
                }
                loading.IsVisible = false;
            }
        }
Пример #2
0
        async private void otherop(object sender, EventArgs e)
        {
            FirebaseAuthResponseModel res = new FirebaseAuthResponseModel()
            {
            };

            res = await DependencyService.Get <iFirebaseAuth>().LoginWithEmailPassword(email.Text, passtxt.Text);

            Application.Current.MainPage = new TabPage();
        }
Пример #3
0
        async private void signout_click(object sender, EventArgs e)
        {
            FirebaseAuthResponseModel res = new FirebaseAuthResponseModel()
            {
            };

            res = DependencyService.Get <iFirebaseAuth>().SignOut();

            if (res.Status == true)
            {
                App.Current.MainPage = new NavigationPage(new MainPage());
            }
            else
            {
                await DisplayAlert("Error", res.Response, "Okay");
            }
        }
Пример #4
0
        private async void signin_click(object sender, EventArgs e)
        {
            if (email.Text == "" || passtxt.Text == "")
            {
                if (email.Text == "")
                {
                    email.BorderColor = Color.Red;
                }
                if (passtxt.Text == "")
                {
                    passtxt.BorderColor = Color.Red;
                }
                await DisplayAlert("Error", "Missing Fields", "Okay");
            }
            else
            {
                loading.IsVisible = true;
                FirebaseAuthResponseModel res = new FirebaseAuthResponseModel()
                {
                };
                res = await DependencyService.Get <iFirebaseAuth>().LoginWithEmailPassword(email.Text, passtxt.Text);

                if (res.Status == true)
                {
                    Application.Current.MainPage = new TabPage();

                    /*
                     * //Use this if you want the master detail page
                     * Application.Current.MainPage = new MainMasterDetailPage();
                     */
                }
                else
                {
                    await DisplayAlert("Error", res.Response, "Okay");
                }
                loading.IsVisible = false;
            }
        }
Пример #5
0
        async private void signup_click(object sender, EventArgs e)
        {
            if (email.Text != "" && user.Text != "" && pass.Text != "")
            {
                if (pass.Text == pass2.Text)
                {
                    loading.IsVisible = true;

                    FirebaseAuthResponseModel res = new FirebaseAuthResponseModel()
                    {
                    };
                    res = await DependencyService.Get <iFirebaseAuth>().SignUpWithEmailPassword(user.Text, email.Text, pass.Text);

                    if (res.Status == true)
                    {
                        try
                        {
                            await CrossCloudFirestore.Current
                            .Instance
                            .GetCollection("users")
                            .GetDocument(dataClass.loggedInUser.uid)
                            .SetDataAsync(dataClass.loggedInUser);

                            await DisplayAlert("Success", res.Response, "Okay");

                            await Navigation.PopModalAsync(true);
                        }
                        catch (Exception ex)
                        {
                            await DisplayAlert("Error", ex.Message, "Okay");
                        }
                    }
                    else
                    {
                        await DisplayAlert("Error", res.Response, "Okay");
                    }
                    loading.IsVisible = false;
                }
                else
                {
                    await DisplayAlert("Error", "Passwords don't match", "Okay");

                    pass2.Text = string.Empty;
                    pass2.Focus();
                }
            }
            else

            {
                if (user.Text == "")
                {
                    user.BorderColor = Color.Red;
                }
                if (email.Text == "")
                {
                    email.BorderColor = Color.Red;
                }
                if (pass.Text == "")
                {
                    pass.BorderColor = Color.Red;
                }
                if (pass2.Text == "")
                {
                    pass2.BorderColor = Color.Red;
                }
                await DisplayAlert("Error", "Missing Fields", "Okay");
            }
        }