コード例 #1
0
        public ActionResult ReceiveTokenAndLogon(string token, string returnUrl)
        {
            IUserAccount user = _externalAuthenticationService.GetUserDetailsFrom(token);

            if (user.IsAuthenticated)
            {
                _formsAuthentications.SetAuthenticationToken(user.AuthenticationToken);
                GetUserRequest getUserRequest = new GetUserRequest();
                getUserRequest.UserID = user.UserID;

                GetUserResponse getUserResponse = _userService.GetUser(getUserRequest);

                if (getUserResponse.UserFound)
                {
                    //return RedirectBasedOn(returnUrl);
                    return(RedirectToAction("Index", "GrowerProfile"));
                }
                else
                {
                    UserAccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not find your user account.  If you don't have an account with us please register.");
                    accountView.CallBackSettings.ReturnUrl = returnUrl;
                    return(View("Login", accountView));
                }
            }
            else
            {
                UserAccountView accountView = InitializeAccountViewWithIssue(true, "Sorry we could not log you in.  Please try again.");
                accountView.CallBackSettings.ReturnUrl = returnUrl;
                return(View("Login", accountView));
            }
        }