Exemplo n.º 1
0
        /// <summary>
        /// This should be called when login is complete. A new account is created
        /// in the AccountManager and the pincode screen is shown if needeed
        /// </summary>
        /// <param name="loginOptions"></param>
        /// <param name="authResponse"></param>
        public async Task OnLoginCompleteAsync(LoginOptions loginOptions, AuthResponse authResponse)
        {
            var frame   = Window.Current.Content as Frame;
            var account = await AccountManager.CreateNewAccount(loginOptions, authResponse);

            if (account.Policy != null && (!PincodeManager.IsPincodeSet() || AuthStorageHelper.IsPincodeRequired()))
            {
                PincodeManager.LaunchPincodeScreen();
            }
            else
            {
                SDKServiceLocator.Get <ILoggingService>().Log($"Navigating to {SDKManager.RootApplicationPage}", LoggingLevel.Information);
                frame?.Navigate(SDKManager.RootApplicationPage);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///     Persist oauth credentials via the AccountManager
        /// </summary>
        /// <param name="loginOptions"></param>
        /// <param name="authResponse"></param>
        public async void EndLoginFlow(LoginOptions loginOptions, AuthResponse authResponse)
        {
            var     frame   = Window.Current.Content as Frame;
            Account account = await AccountManager.CreateNewAccount(loginOptions, authResponse);

            if (account.Policy != null && (!PincodeManager.IsPincodeSet() || AuthStorageHelper.IsPincodeRequired()))
            {
                PincodeManager.LaunchPincodeScreen();
            }
            else
            {
                PlatformAdapter.SendToCustomLogger(string.Format("AuthHelper.EndLoginFlow - Navigating to {0}",
                                                                 SDKManager.RootApplicationPage), LoggingLevel.Information);
                frame.Navigate(SDKManager.RootApplicationPage);
            }
        }
 private void ConfirmClicked(object sender, KeyRoutedEventArgs e)
 {
     if (e.Key != VirtualKey.Accept && e.Key != VirtualKey.Enter)
     {
         return;
     }
     e.Handled = true;
     if (Passcode.Password.Equals(Options.Passcode))
     {
         LoggingService.Log($"Pincode matched, going to {SDKManager.RootApplicationPage}", LoggingLevel.Verbose);
         AuthStorageHelper.StorePincode(Options.Policy, Options.Passcode);
         PincodeManager.Unlock();
         Frame.Navigate(SDKManager.RootApplicationPage);
     }
     else
     {
         DisplayErrorFlyout(LocalizedStrings.GetString("passcode_must_match"));
     }
 }
        private async void LockedClick(object sender, KeyRoutedEventArgs e)
        {
            if (e.Key != VirtualKey.Accept && e.Key != VirtualKey.Enter)
            {
                return;
            }
            e.Handled = true;
            Account account = AccountManager.GetAccount();

            if (account == null)
            {
                await SDKServiceLocator.Get <IAuthHelper>().StartLoginFlowAsync();
            }
            else if (AuthStorageHelper.ValidatePincode(Passcode.Password))
            {
                PincodeManager.Unlock();
                if (Frame.CanGoBack)
                {
                    Frame.GoBack();
                }
                else
                {
                    Frame.Navigate(SDKManager.RootApplicationPage);
                }
            }
            else
            {
                if (RetryCounter <= 1)
                {
                    await SDKManager.GlobalClientManager.Logout();
                }
                RetryCounter--;
                ContentFooter.Text       = String.Format(LocalizedStrings.GetString("passcode_incorrect"), RetryCounter);
                ContentFooter.Visibility = Visibility.Visible;
            }
        }