Пример #1
0
        private async Task InitiateLoginAsync()
        {
            var loginSuccess = false;

            // TODO
            // all of the paths out of this loop
            //      -- HandleUnknownFailureAsync()
            //      -- ResetPasswordAsync()
            //      -- CheckForCanceledAsync
            // need to be implemented so as to return here after their
            // awaits complete...
            //
            while (!loginSuccess)
            {
                try
                {
                    loginSuccess = await _tokenManager.RequestLoginAsync();

                    if (!loginSuccess)
                    {
                        await HandleUnknownFailureAsync();
                    }
                    else
                    {
                        _hasLoggedInOnce = true;
                        await _navigation.PopModalAsync();
                    }
                }
                catch (Exception e)
                {
                    if (e.Message.Contains(LrpConstants.PasswordResetMessageContents))
                    {
                        await ResetPasswordAsync();
                    }
                    else
                    {
                        await CheckForCanceledAsync(e);

                        loginSuccess = true; // well, not really, but the user canceled the login
                    }                        // so we return them to the login page --
                                             // they'll need to click login again
                }
            }
        }