Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question - Umbraco Content within ExternalLoginFailure #143

Open
OwainWilliams opened this issue Jul 14, 2021 · 1 comment
Open

Question - Umbraco Content within ExternalLoginFailure #143

OwainWilliams opened this issue Jul 14, 2021 · 1 comment

Comments

@OwainWilliams
Copy link

Hi Shannon,

We’ve got the UmbracoIdentity package installed and we are looking to style the ExternalLoginFailure view. However, we can’t figure out how to get the current site reference into the request pipeline. Ideally, we would like to be able to use the master template that the site uses and have the same navigation driven by Umbraco Content, but when we try to get the Umbraco root node of the site our rendering breaks with the following error:
Cannot return the IPublishedContent because the UmbracoHelper was not constructed with an IPublishedContent..

The ExternalLoginFailure view is called from the ExteralLoginCallback method and from the ExternalLoginFailure method. The Latter of which we are using as a test call and have modified it as follows:

public ActionResult ExternalLoginFailure(string returnUrl = null)
        {
            IPublishedContent node = UmbracoContext.Content.GetByRoute(returnUrl.IfNullOrWhiteSpace("/"));
            if(node != null)
            {
                var siteRoot = node.Root();
                var loginFailureDetails = siteRoot.FirstChildOfType(LoginFailure.ModelTypeAlias);
                if (loginFailureDetails != null)
                    node = loginFailureDetails;
            }

            return View("ExternalLoginFailure", node);
        }

Fundamentally, the question we have is:

How can we incorporate our site properly into the views returned back from this controller to ensure we have consistent branding etc without having to duplicate lost of html/render code?

Thanks

@OwainWilliams
Copy link
Author

Hi @Shazwazza - Just wondered if you had any thoughts on this at all? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant