Exemplo n.º 1
0
        private void ForgotPasswordTextView_Click(object sender, EventArgs e)
        {
            resetListener         = new ResetPasswordListener();
            resetPasswordFragment = new ResetPasswordFragment();
            //this.Window.SetBackgroundDrawable(new Android.Graphics.Drawables.ColorDrawable(Android.Graphics.Color.Transparent));
            var trans = SupportFragmentManager.BeginTransaction();

            resetPasswordFragment.Cancelable = true;
            resetPasswordFragment.Show(trans, "reset_password");
            resetPasswordFragment.OnPasswordReset += (s, args) =>
            {
                string email = args.Email;
                if (email != "")
                {
                    Android.Support.V7.App.AlertDialog.Builder confirmResetDialog =
                        new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.AppCompatAlertDialogStyle);
                    confirmResetDialog.SetMessage("Reset password?");

                    confirmResetDialog.SetNegativeButton("Cancel", (thisalert, args) =>
                    {
                        resetPasswordFragment.Dismiss();
                    });
                    confirmResetDialog.SetPositiveButton("Reset", (thisalert, args) =>
                    {
                        resetListener.ResetPassword(auth, email);
                        resetPasswordFragment.Dismiss();
                    });
                    confirmResetDialog.Show();
                }
                else
                {
                    Toast.MakeText(this, "Please enter an email", ToastLength.Short).Show();
                }
            };
            resetListener.listener.Failure += (s, args) =>
            {
                Toast.MakeText(this, "Password failed to reset due to an error: " + args.Cause, ToastLength.Long).Show();
            };
            resetListener.listener.Success += (s, args) =>
            {
                Toast.MakeText(this, "Check your mail box", ToastLength.Short).Show();
            };
        }
Exemplo n.º 2
0
        private void ChangePasswordProfileTextView_Click(object sender, EventArgs e)
        {
            resetListener         = new ResetPasswordListener();
            resetPasswordFragment = new ResetPasswordFragment();
            var trans = SupportFragmentManager.BeginTransaction();

            resetPasswordFragment.Cancelable = true;
            resetPasswordFragment.Show(trans, "reset_password");
            resetPasswordFragment.OnPasswordReset += (s, args) =>
            {
                string email = args.Email;
                Android.Support.V7.App.AlertDialog.Builder confirmResetDialog =
                    new Android.Support.V7.App.AlertDialog.Builder(this, Resource.Style.AppCompatAlertDialogStyle);
                confirmResetDialog.SetMessage("Reset password?");

                confirmResetDialog.SetNegativeButton("Cancel", (thisalert, args) =>
                {
                    resetPasswordFragment.Dismiss();
                });
                confirmResetDialog.SetPositiveButton("Reset", (thisalert, args) =>
                {
                    if (email == Helpers.Helper.GetEmail())
                    {
                        resetListener.ResetPassword(FirebaseBackend.FirebaseBackend.GetFireAuth(), email);
                        resetPasswordFragment.Dismiss();
                    }
                    else
                    {
                        Toast.MakeText(this, "Please confirm your email", ToastLength.Long).Show();
                    }
                });
                confirmResetDialog.Show();
            };
            resetListener.listener.Failure += (s, args) =>
            {
                Toast.MakeText(this, "Password failed to reset due to an error: " + args.Cause, ToastLength.Long).Show();
            };
            resetListener.listener.Success += (s, args) =>
            {
                Toast.MakeText(this, "Check your mail box", ToastLength.Short).Show();
            };
        }
Exemplo n.º 3
0
        protected override void initializeFragments()
        {
            base.initializeFragments();

            loginFragment    = new LoginFragment();
            registerFragment = new RegisterFragment();
            resetFragment    = new ResetPasswordFragment();

            var trans = SupportFragmentManager.BeginTransaction();

            trans.Add(Resource.Id.fragmentContainer, registerFragment, "register");
            trans.Hide(registerFragment);

            trans.Add(Resource.Id.fragmentContainer, resetFragment, "reset");
            trans.Hide(resetFragment);

            trans.Add(Resource.Id.fragmentContainer, loginFragment, "login");

            currentFragment = loginFragment;

            trans.Commit();
        }