Beispiel #1
0
        public async Task OnLogin()
        {
            AppAuthenticationStateProvider authStateProvider = this.AuthenticationStateProvider as AppAuthenticationStateProvider;

            authStateProvider.UserName     = UserLogin;
            authStateProvider.UserPassword = UserPassword;
            authStateProvider.IsRegister   = false;

            AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            if (!authState.User.Identity.IsAuthenticated)
            {
                errorMessage = authStateProvider.ErrorMessage;
            }
            else
            {
                errorMessage = null;

                NavigationManager.NavigateTo("search");
            }

            //await loginNotificator.UpdateLoginState(authState.User.Identity.IsAuthenticated);



            //this.AuthenticationStateProvider.NotifyAuthenticationStateChanged();

            //this.StateHasChanged(); // re-render the page
        }
Beispiel #2
0
        public async Task OnLogOut()
        {
            AppAuthenticationStateProvider authStateProvider = this.AuthenticationStateProvider as AppAuthenticationStateProvider;

            authStateProvider.UserName = "";
            AuthenticationState authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();

            //await loginNotificator.UpdateLoginState(authState.User.Identity.IsAuthenticated);



            //this.AuthenticationStateProvider.NotifyAuthenticationStateChanged();

            //this.StateHasChanged(); // re-render the page
        }