Пример #1
0
        public void CanGetAuthorization()
        {
            if (!Debugger.IsAttached)
            {
                return;
            }

            var response = WebApiService.GetAuthorization("SmithCaesars", "1970/01/01", "4321");

            Assert.IsNotNull(response);
        }
Пример #2
0
        public ActionResult SignIn(string id, FormCollection collection)
        {
            bool authenticated   = false;
            var  campaignSession = CampaignSessionModel.Current;

            if (!string.IsNullOrEmpty(campaignSession.ExperienceUserId))
            {
                var signIn = new SignInModel {
                    Id = id
                };

                if (TryUpdateModel(signIn))
                {
                    campaignSession.LastName    = signIn.LastName;
                    campaignSession.DateOfBirth = signIn.BirthDate;
                    campaignSession.LastFour    = signIn.Ssn;

                    AuthorizationResponse authResponse =
                        WebApiService.GetAuthorization(lastName: campaignSession.LastName,
                                                       dateOfBirth: campaignSession.DateOfBirth, lastFour: campaignSession.LastFour);

                    if (!string.IsNullOrEmpty(authResponse.AuthHash))
                    {
                        campaignSession.AuthorizationHash = authResponse.AuthHash;
                        authenticated = true;
                    }
                    CampaignSessionModel.Current = campaignSession;
                }
            }
            if (authenticated)
            {
                HelperService.LogUserEvent(ExperienceEvents.AuthenticationSuccess, campaignSession.LastName);

                campaignSession = WebApiService.GetCampaignSession(CampaignSessionModel.Current);

                CampaignSessionModel.Current = campaignSession;

                return(RedirectToAction("Dynamic"));
            }
            HelperService.LogAnonEvent(ExperienceEvents.AuthenticationFail, campaignSession.LastName);

            return(RedirectToAction("Oops"));
        }