Exemplo n.º 1
0
        public async Task <ActionResult> LoginPage(LoginUserModel loginUserModel)
        {
            if (ModelState.IsValid)
            {
                TokenContent rest = await _loginApiService.Authenticate(ApiUrl + "token", loginUserModel);

                if (rest.access_token != null)
                {
                    InstructorDto ınstructorDto = await _userApiService.Get(rest.access_token, ApiUrl + "api/User", loginUserModel);

                    string[] roles = new string[ınstructorDto.Roles.Count];
                    for (int i = 0; i < ınstructorDto.Roles.Count; i++)
                    {
                        ınstructorDto.Roles.ForEach(x => roles[i] = x.Name.ToString());
                    }


                    AuthenticationHelper.CreateAuthCookie(ınstructorDto.Id, ınstructorDto.UserName, DateTime.Now.AddDays(1), roles, false, ınstructorDto.FirstName, ınstructorDto.LastName);
                    //FormsAuthentication.SetAuthCookie(loginUserModel.Username, false);



                    Session["access_token"] = rest.access_token;
                    return(RedirectToAction("Index", "Home"));
                }

                ViewBag.LoginError = "Kullanıcı Adı ve paralo uyuşmamaktadır!";
            }

            return(View(loginUserModel));
        }
Exemplo n.º 2
0
        private async void UpdateUser()
        {
            var result = await UserApiService.Get();

            if (!result.Error)
            {
                AppStatus.UserLogged = result;
            }
        }
Exemplo n.º 3
0
        private async void RequestProfile()
        {
            var response = await UserApiService.Get();

            if (response != null && !response.Error)
            {
                AppStatus.UserLogged = response;

                UpdateInfoProfile();
            }
        }
Exemplo n.º 4
0
        public async void RequestProfile(bool updateUser)
        {
            try
            {
                UpdateInfoProfile();

                if (updateUser)
                {
                    var response = await UserApiService.Get();

                    if (response != null && !response.Error)
                    {
                        AppStatus.UserLogged = response;

                        UpdateInfoProfile();
                    }
                }
            }
            catch (Exception exception)
            {
                InsightsUtils.LogException(exception);
            }
        }
Exemplo n.º 5
0
        protected async Task Load()
        {
            Items = await UserApiService.Get();

            IsLoading = false;
        }
Exemplo n.º 6
0
        protected async Task Load()
        {
            _user = await UserApiService.Get(Id);

            IsLoading = false;
        }