コード例 #1
0
        public ActionResult Create()
        {
            if (_authenticationManager.User != null)
            {
                var subClaim = _authenticationManager.User.Claims.FirstOrDefault(c => c.Type == "sub");

                if (subClaim != null)
                {
                    // call sync
                    var response = _coreClient.GetContactDetails(subClaim.Value);
                    if (response != null && !response.Errored && response.Body != null)
                    {
                        return(View(new
                        {
                            PasswordSet = !String.IsNullOrWhiteSpace(response.Body.PasswordType) && response.Body.PasswordType.ToLowerInvariant() != "firsttime",
                            PrimaryEmailExists = !String.IsNullOrWhiteSpace(response.Body.Email),
                            PrimaryPhoneExists = !String.IsNullOrWhiteSpace(response.Body.MobileNumber)
                        }));
                    }
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
            }
            return(new HttpUnauthorizedResult("Not authorized"));
        }