Esempio n. 1
0
        private void changeParameters(object sender, RoutedEventArgs e)
        {
            samePasswordError.Visibility  = Visibility.Hidden;
            oldPasswordError.Visibility   = Visibility.Hidden;
            ModificationReussi.Visibility = Visibility.Hidden;
            mailInvalide.Visibility       = Visibility.Hidden;
            Connexion c = new Connexion();

            if ((!Email.Text.Equals(null)) && (!oldPassword.Password.Equals(null)))
            {
                if (c.verifierLogin(this.user, oldPassword.Password))
                {
                    if (newPassword.Password.Equals(newPasswordVerification.Password))
                    {
                        if (Regex.IsMatch(Email.Text, @"^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}"))
                        {
                            if (c.modifierComptePassword(Email.Text.Replace("'", "''"), newPassword.Password))
                            {
                                this.user                        = Email.Text;
                                Email.Text                       = this.user;
                                oldPassword.Password             = null;
                                newPassword.Password             = null;
                                newPasswordVerification.Password = null;
                                ModificationReussi.Visibility    = Visibility.Visible;
                            }
                        }
                        else
                        {
                            mailInvalide.Visibility = Visibility.Visible;
                        }
                    }
                    else
                    {
                        Email.Text                       = this.user;
                        oldPassword.Password             = null;
                        newPassword.Password             = null;
                        newPasswordVerification.Password = null;
                        samePasswordError.Visibility     = Visibility.Visible;
                    }
                }
                else
                {
                    Email.Text                       = this.user;
                    oldPassword.Password             = null;
                    newPassword.Password             = null;
                    newPasswordVerification.Password = null;
                    oldPasswordError.Visibility      = Visibility.Visible;
                }
            }
        }