コード例 #1
0
        public async Task MergeUserContactsAsync_ConnotProcessContact_ReturnsNull()
        {
            // Arrange
            mContactProcessingChecker.CanProcessContactInCurrentContext().Returns(false);

            // Act
            await mContactTrackingService.MergeUserContactsAsync(string.Empty);

            // Assert
            CMSAssert.All(
                () => mCurrectContactProvider.DidNotReceive().GetCurrentContact(Arg.Any <IUserInfo>(), Arg.Any <bool>()),
                () => mCurrectContactProvider.DidNotReceive().SetCurrentContact(Arg.Any <ContactInfo>())
                );
        }
コード例 #2
0
        private async void DummyContactMergeMethod()
        {
            //DocSection:MergeContact
            await contactTrackingService.MergeUserContactsAsync(userName);

            //EndDocSection:MergeContact
        }
コード例 #3
0
        public async Task MergeUserContactsAsync_IsCrawler_ReturnsNull()
        {
            // Arrange
            var crawlerService = (CrawlerCheckerFake)Service <ICrawlerChecker> .Entry();

            crawlerService.Crawler = true;

            // Act
            await mContactTrackingService.MergeUserContactsAsync(string.Empty);

            // Assert
            CMSAssert.All(
                () => Assert.That(() => mCurrectContactProvider.GetCurrentContactFlag, Is.EqualTo(0), "CurrectContactProvider.GetCurrentContact should not be called."),
                () => Assert.That(() => mCurrectContactProvider.SetCurrentContactFlag, Is.EqualTo(0), "CurrectContactProvider.SetCurrentContact should not be called.")
                );
        }
コード例 #4
0
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var signInResult = SignInStatus.Failure;

            try
            {
                signInResult = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.StaySignedIn, false);
            }
            catch (Exception ex)
            {
                EventLogProvider.LogException("AccountController", "Login", ex);
            }

            if (signInResult == SignInStatus.Success)
            {
                await mContactTrackingService.MergeUserContactsAsync(model.UserName);

                mMembershipActivitiesLogger.LogLoginActivity(model.UserName);

                var decodedReturnUrl = Server.UrlDecode(returnUrl);
                if (!string.IsNullOrEmpty(decodedReturnUrl) && Url.IsLocalUrl(decodedReturnUrl))
                {
                    return(Redirect(decodedReturnUrl));
                }

                return(RedirectToAction("Index", "Home"));
            }

            ModelState.AddModelError(String.Empty, ResHelper.GetString("login_failuretext"));

            return(View(model));
        }