Example #1
0
 public void Encrypt_Decrypt_ShouldReturnSame()
 {
     CredentialServiceObject.SaveCredentials("test1", "test2");
     string[] expected = new string[] { "test1", "test2" };
     string[] actual   = CredentialServiceObject.GetSavedCredentials();
     Assert.AreEqual(expected, actual);
 }
Example #2
0
        private async Task LoginAsync()
        {
            CheckAuthentication auth = new CheckAuthentication();

            auth.authentication          = new Authentication();
            auth.authentication.password = Password;
            auth.authentication.userName = UserName;

            bool result = await IsValidAuthentication(auth);

            if (result)
            {
                if (PasswordShouldBeSaved)
                {
                    CService.SaveCredentials(UserName, Password);
                }
                MvvmNanoIoC.RegisterAsSingleton <Authentication>(auth.authentication);
                NavigateTo <MasterDetailViewModel>();
            }
            else
            {
                Info     = true;
                InfoText = "Passwort ist nicht korrekt";
                Debug.WriteLine("Not authenticated");
                NotifyPropertyChanged("Info");
                NotifyPropertyChanged("InfoText");
            }
        }
        public void Sign_In(string username, string password)
        {
            IMAPServiceObject.ConnectToIMAPService(username, password);
            CredentialServiceObject.SaveCredentials(username, password);
            MainWindow mainWindow = new MainWindow(IMAPServiceObject);

            mainWindow.Show();
        }
Example #4
0
        public void SignIn(string emailTxt, string passwordTxt, CheckBox stayLoggedIn)
        {
            mailService.ConnectingToIMAPService(emailTxt, passwordTxt);
            if (mailService.AuthenticateIsCorrect())
            {
                if ((bool)stayLoggedIn.IsChecked)
                {
                    CredentialServiceObject.SaveCredentials(emailTxt, passwordTxt);
                }

                InboxWindow inboxWindow = new InboxWindow(mailService);
                inboxWindow.Show();
            }
            else
            {
                throw new ArgumentException();
            }
        }