Esempio n. 1
0
        //Program Sistem Lupa Password
        private void Btngantipassword_Click(object sender, RoutedEventArgs e)
        {
            FirebaseResponse res    = client.Get(@"Data/" + txtusername.Text);
            MyLupaPassword   Reuser = res.ResultAs <MyLupaPassword>();

            MyLupaPassword Lupa = new MyLupaPassword()
            {
                Username  = txtusername.Text,
                Email     = txtemail.Text,
                NoTelepon = txtnotelepon.Text,
                Password  = txtpassword.Password
            };

            if (MyLupaPassword.IsEqual(Reuser, Lupa))
            {
                MyLupaPassword user = new MyLupaPassword()
                {
                    Username  = txtusername.Text,
                    Email     = txtemail.Text,
                    NoTelepon = txtnotelepon.Text,
                    Password  = txtpassword.Password
                };
                FirebaseResponse response = client.Update(@"Data/" + txtusername.Text, user);

                MsgError("Password anda telah diganti yang baru");
            }
            else
            {
                MsgError("Check kembali akun anda");
            }
        }
 public static bool IsEqual(MyLupaPassword user1, MyLupaPassword user2)
 {
     if (user1 == null || user2 == null)
     {
         return(false);
     }
     if (user1.Username != user2.Username)
     {
         return(false);
     }
     else if (user1.Email != user2.Email)
     {
         return(false);
     }
     else if (user1.NoTelepon != user2.NoTelepon)
     {
         return(false);
     }
     return(true);
 }