示例#1
0
        /// <summary>
        /// This method Store Local Store Items
        /// </summary>
        public async Task <bool> StoreLocalStoreItems(string emailAddress, string passwordHash)
        {
            // initial value
            bool saved = false;

            try
            {
                // try saving
                await ProtectedLocalStore.SetAsync("RememberLogin", true);

                await ProtectedLocalStore.SetAsync("EmailAddress", emailAddress);

                await ProtectedLocalStore.SetAsync("PasswordHash", passwordHash);

                // presumption
                saved = true;
            }
            catch (Exception error)
            {
                // for debugging only for now
                DebugHelper.WriteDebugError("StoreLocalStoreItems", "Index.razor.cs", error);
            }

            // return value
            return(saved);
        }
示例#2
0
        /// <summary>
        /// This method Removed Local Store Items
        /// </summary>
        public async Task <bool> RemovedLocalStoreItems()
        {
            // initial value
            bool removed = false;

            try
            {
                // if the ProtectedLocalStore exists
                if (ProtectedLocalStore != null)
                {
                    // delete doesn't seem to work, so I am setting to false
                    await ProtectedLocalStore.SetAsync("RememberLogin", false);

                    // Remove all items
                    await ProtectedLocalStore.DeleteAsync("RememberPassword");

                    await ProtectedLocalStore.DeleteAsync("EmailAddress");

                    await ProtectedLocalStore.DeleteAsync("PasswordHash");
                }

                // set to true
                removed = true;
            }
            catch (Exception error)
            {
                // for debugging only
                DebugHelper.WriteDebugError("RemoveLocalStoreItems", "Login.cs", error);
            }

            // return value
            return(removed);
        }
        /// <summary>
        /// This method Handle Remember Password
        /// </summary>
        public async void HandleRememberPassword()
        {
            // if remember login details is true
            if ((HasLoginResponse) && (RememberLogin) && (LoginResponse.HasArtist))
            {
                // Set the artist
                artist = LoginResponse.Artist;

                await ProtectedLocalStore.SetAsync("RememberLogin", rememberLogin);

                await ProtectedLocalStore.SetAsync("ArtistEmailAddress", artist.EmailAddress);

                await ProtectedLocalStore.SetAsync("ArtistPasswordHash", artist.PasswordHash);
            }
            else
            {
                // Remove any locally stored items
                RemovedLocalStoreItems();
            }
        }
        /// <summary>
        /// This method Removed Local Store Items
        /// </summary>
        public async void RemovedLocalStoreItems()
        {
            try
            {
                // if the ProtectedLocalStore exists
                if (ProtectedLocalStore != null)
                {
                    // delete doesn't seem to work, so I am setting to false
                    await ProtectedLocalStore.SetAsync("RememberLogin", false);

                    // Remove all items
                    //await ProtectedLocalStore.DeleteAsync("RememberPassword");
                    //await ProtectedLocalStore.DeleteAsync("ArtistEmailAddress");
                    //await ProtectedLocalStore.DeleteAsync("ArtistPasswordHash");
                }
            }
            catch (Exception error)
            {
                // for debugging only
                DebugHelper.WriteDebugError("RemoveLocalStoreItems", "Login.cs", error);
            }
        }