예제 #1
0
        public async Task Logout()
        {
            userInfo = null;
            //var result = await _httpClient.PostAsync("api/Authorize/Logout", null);
            //result.EnsureSuccessStatusCode();
            await _abpClient.Logout();

            await Task.CompletedTask;
        }
예제 #2
0
        public async Task <UserInfo> Login(LoginParameters loginParameters)
        {
            // Todo Handle StatusCodes??
            //var result = new UserInfo { IsAuthenticated = true, Username = "******" };
            //var result = await _httpClient.PostJsonAsync<UserInfo>("api/Authorize/Login", loginParameters);
            AuthenticateModel model = new AuthenticateModel {
                UserNameOrEmailAddress = loginParameters.UserName,
                Password       = loginParameters.Password,
                RememberClient = loginParameters.RememberMe,
            };
            var user = await _abpClient.Login(model);

            if (user != null)
            {
                userInfo = user;
                return(new UserInfo {
                    IsAuthenticated = true, Username = user.Username
                });
            }
            await Task.CompletedTask;

            return(null);
        }