internal bool NeedValue(UserMap map, Dictionary <string, string> currentClaims, out UserMap CurrentValue) { CurrentValue = map; #if DEBUG if (currentClaims.ContainsKey(map.ClaimType)) { this.Controls.Add(new LiteralControl("<div><span>Have data for: " + map.ClaimType + "</span><span>-</span><span>" + currentClaims[map.ClaimType] + "</span></div>")); } else { this.Controls.Add(new LiteralControl("<div>Missing data for: " + map.ClaimType + "</div>")); } #endif /*if (String.IsNullOrEmpty(uP[map.ProfileProperty].Value as string)) * {*/ if (currentClaims.ContainsKey(map.ClaimType)) { //UpdateProfile(map.ProfileProperty, currentClaims[map.ClaimType]); CurrentValue.ClaimValue = currentClaims[map.ClaimType]; return(false); } else if (_claimsCookie != null) { string lower = _claimsCookie.Value.ToLower(); if (lower.Contains(map.ClaimType.ToLower()) || lower.Contains(map.B2CField.ToLower()) || lower.Contains(map.B2CField.Replace("a67c327875c34024bd4523a3d66619ba", "be6dc6c96b4c411780751b4231962926").ToLower())) { return(false); } else { return(true); } } else { return(true); } /*} * else * CurrentValue.ClaimValue = uP[map.ProfileProperty].Value as string;*/ return(false); }
protected override void CreateChildControls() { try { List <UserMap> map = GetRequiredInformation(); Dictionary <string, string> claims = GetClaimsForUser(); if (claims["identityprovider"] == "windows") { return; } if (claims.ContainsKey("extensionAttribute6")) { if (claims["extensionAttribute6"] == "Internal_USER") { return; } } if (claims.ContainsKey("upn")) { upn = claims["upn"]; } //uP = GetCurrentProfile(); bool showForm = false; for (int i = 0; i < map.Count; i++) { UserMap n = null; if (NeedValue(map[i], claims, out n)) { showForm = true; } else { map[i] = n; } } if (showForm && !HttpContext.Current.Request.Url.AbsolutePath.ToLower().Contains("manageprofile.aspx")) { HttpResponse res = HttpContext.Current.Response; res.Redirect(SPContext.Current.Site.Url + "/Pages/ManageProfile.aspx?RequiredFields=true"); /*content = new Panel(); * content.CssClass = "RegistrationOverlay"; * submitBtn = new Button(); * submitBtn.CssClass = "btn"; * submitBtn.Text = "Update"; * submitBtn.UseSubmitBehavior = true; * submitBtn.Click += SubmitBtn_Click; * content.Controls.Add(new LiteralControl("<div class='registrationForm'><h1>Complete Registration Process</h1><div class='form'>")); * ShowForm(map); * content.Controls.Add(submitBtn); * content.Controls.Add(new LiteralControl("</div></div>")); * this.Controls.Add(content);*/ } } catch (Exception ex) { this.Controls.Add(new LiteralControl("<div class='error'><div>Error in validation of required attributes</div><div class='msg'>" + ex.Message + "</div><div class='trace' style='display:none'>" + ex.StackTrace + "</div><div class='innerException' style='display:none'>" + ex.InnerException + "</div></div>")); } }