Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Umbraco Beginner 10 posts 110 karma points
    Sep 12, 2019 @ 16:17
    Umbraco Beginner
    0

    Secure the custom comment form (partial view)

    Hello Umbraco Experts,

    I am building a page where a people can comment on the content. I have build the content type for blog post and embedded a partial view with a comment form.

    I want to provide ability to comment to a content only to a authenticate member but everybody(even unauthenticated members) can view/read the blog post.

    To protect the page, I have used public access node from the admin portal but in this case I only want to implement public access rule to partial page. Any ideas?

    May be the structure will be something similar to ..... https://stackoverflow.com/questions/57910737/extract-from-a-character-in-r

  • Shaishav Karnani from digitallymedia.com 354 posts 1638 karma points
    Sep 12, 2019 @ 17:54
    Shaishav Karnani from digitallymedia.com
    100

    Hi,

    If you use public access node then it will make your blog page as private and will not allow user to view the page. And from your comments you don't want it. So, we should remove this check.

    Instead, you can simply check if Member is logged in then show partial otherwise show Login screen.

    @if(Umbraco.MemberIsLoggedOn()){ 
        @Html.Partial("comments")
    }
    else {
       // Login code or something else...
    }
    

    Hope this helps.

    Cheers,

    Shaishav

  • Umbraco Beginner 10 posts 110 karma points
    Sep 13, 2019 @ 15:06
    Umbraco Beginner
    0

    Thanks. I also managed to implement if authenticated user has a permission to comment.

Please Sign in or register to post replies

Write your reply to:

Draft