internal void SubmitCodeVerification(object element)
        {
            ErrorMessage = String.Empty;

            if (ConfirmCode())
            {
                bool profileExists   = false;
                var  isAuthenticated = pbData.AuthenticateUser(UserEmail, _masterPass, out profileExists);

                if (!isAuthenticated)
                {
                    Application.Current.Dispatcher.Invoke((Action) delegate
                    {
                        ErrorMessage = (string)System.Windows.Application.Current.FindResource("IncorrectMailOrPasswordMessage");
                    });
                    return;
                }

                pbData.OpenProfile(UserEmail, _masterPass, out profileExists);
                _masterPass      = string.Empty;
                VerificationCode = "";
                CodeVerificationErrorMessageCode = "";
                //installationDate.Value.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")
                pbData.ChangePrivateSetting(DefaultProperties.Settings_Device_IsDeviceTrustedLastChecked, DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffZ"));
                if (IsThisComputerTrusted)
                {
                    pbData.ChangePrivateSetting(DefaultProperties.Settings_Device_IsDeviceTrusted, IsThisComputerTrusted.ToString());
                }
                //IsTwoStepVerificationPassed = true;

                ShowMainWindow();

                CodeVerificationGridVisibility = false;
                advertisingGrid.Visibility     = Visibility.Visible;
            }
            else
            {
                CodeVerificationErrorMessageCode = "Invalid confirmation code, please try again";
            }
        }
Beispiel #2
0
        //public void StartBackgroundTasks()
        //{
        //	generateKeysStep.ExecuteAsync();
        //}

        //public void CancelBackgroundTasks()
        //{
        //	try
        //	{
        //		generateKeysStep.CancellationTokenSource.Cancel();
        //	}
        //	catch (Exception ex)
        //	{
        //		logger.Debug(ex.ToString());
        //	}
        //}

        public Tuple <bool, bool> AuthenticateUser(string userEmailId, string password)
        {
            var profileExists   = false;
            var isAuthenticated = pbData.AuthenticateUser(userEmailId, password, out profileExists);

            if (!profileExists)
            {
                profileExists = CheckAccount(userEmailId);
            }

            if (profileExists)
            {
                //CancelBackgroundTasks();
            }

            return(new Tuple <bool, bool>(isAuthenticated, profileExists));
        }