Exemplo n.º 1
0
        public async Task <bool> LogoutAsync()
        {
            if (!IsInitialized)
            {
                await InitializeAsync();
            }

            await MobileService.LogoutAsync();

            var settings = await ReadSettingsAsync();

            if (settings != null)
            {
                settings.AuthToken = string.Empty;
                settings.UserId    = string.Empty;

                var result = await SaveSettingsAsync(settings);

                return(result);
            }
            else
            {
                return(true);
            }
        }
        public async Task <bool> LogoutAsync()
        {
            bool success = false;

            try
            {
                if (User != null)
                {
                    await MobileService.LogoutAsync();

                    foreach (var user in ADB2CClient.Users)
                    {
                        ADB2CClient.Remove(user);
                    }
                    User = null;

                    Settings.AuthToken = string.Empty;
                    Settings.UserId    = string.Empty;
                    Settings.Role      = string.Empty;

                    success = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(success);
        }
Exemplo n.º 3
0
        public async Task LogoutAsync()
        {
            if (!IsInitialized)
            {
                await InitializeAsync();
            }

            await MobileService.LogoutAsync();

            StoreSettings settings = null;

            try
            {
                settings = await ReadSettingsAsync();
            }
            catch (MobileServicePushFailedException exc)
            {
                if (exc.PushResult != null)
                {
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Unable to read settings items: " + ex);
            }

            if (settings != null)
            {
                settings.AuthToken = string.Empty;
                settings.UserId    = string.Empty;

                await SaveSettingsAsync(settings);
            }
        }
        public async Task LogoutAsync()
        {
            await DeleteCurrentUser();

            LogoutNative();
            await MobileService.LogoutAsync();

            CurrentUser = null;
        }
Exemplo n.º 5
0
        public async Task LogoutAsync()
        {
            if (!IsInitialized)
            {
                await InitializeAsync();
            }

            await MobileService.LogoutAsync();

            var settings = await ReadSettingsAsync();

            if (settings != null)
            {
                settings.AuthToken = string.Empty;
                settings.UserId    = string.Empty;

                await SaveSettingsAsync(settings);
            }
        }
        async public Task Logout()
        {
            try
            {
                // If authentication is enabled and we're logged in then logout
                if (Authenticator != null && IsAuthenticated)
                {
                    await MobileService.LogoutAsync();

                    IsAuthenticated = false;
                    LoginStatus     = "Login";

                    // Login is only manditory if mode is online-only and authentication is required
                    IsLoginNeeded = ApplicationCapabilities.IsAuthenticationRequired &&
                                    ApplicationCapabilities.ModeOfOperation == ModeOfOperation.OnlineOnly;
                }
            }
            catch (Exception e)
            {
                // ToDo: handle this situation properly by using MVVM Light message
            }
        }