how Public Access -> single user protection -> login page
Hi
I am using Umbraco 7.2x
I have the requirement where one of my page should not be access publically. Not all user can be able to access this page.
One way i have found that I can create one login Page where admin can enter the credentials and access the page
OR
I have found that i can use 'Public Access' option for any node inside the Content. So i have choossen "Single User Protection" where i need to add User Name & Password and select the login & error page. My question is that if i define login page with "Login" button then do i need to write any CODE to validate the admin entered details(username, password) with the detail we have added in Umbraco 'Public Access -> Single User Protection" ?
If yes then can any one pleaes let me guide here ?
Umbraco provides a macro snippet that should do most of the work, you just need to make it available.
In the Umbraco Backoffice under the Developer section, right click on Partial View Macro Files and select Create. Give the new macro partial a name and select the Login snippet. This will create a new cshtml file in your solution with most of the login logic in place. You will now have to create a Macro that links to this file and takes a redirectUrl parameter of type Content Picker. Embed this macro into the richtext editor of any page and you now have your login for Public Access.
To get this to work for me, I had to make a slight tweak to the login snippet. Add this underneath the declaration of loginModel:
var loginUrlPart = Umbraco.Content(Model.Content.Id).Url;
var currentUrl = Request.RawUrl;
/**
* This conditional redirect is necessary due to Umbraco's use of Public Access.
* Rather than setting a query string redirect url, Umbraco alters the raw URL to be the referrer.
* So, if the raw url is anything but the sign in page's url, then we redirect to the raw url.
* Otherwise, use the macro parameter, redirectUrl.
*/
//
// Rather than
loginModel.RedirectUrl = currentUrl.Contains(loginUrlPart) ?
Umbraco.Content(Model.MacroParameters["redirectUrl"]).Url :
currentUrl;
how Public Access -> single user protection -> login page
Hi
I am using Umbraco 7.2x
I have the requirement where one of my page should not be access publically. Not all user can be able to access this page.
One way i have found that I can create one login Page where admin can enter the credentials and access the page
OR
I have found that i can use 'Public Access' option for any node inside the Content. So i have choossen "Single User Protection" where i need to add User Name & Password and select the login & error page. My question is that if i define login page with "Login" button then do i need to write any CODE to validate the admin entered details(username, password) with the detail we have added in Umbraco 'Public Access -> Single User Protection" ?
If yes then can any one pleaes let me guide here ?
thanks in advance !
rohan
Hi Rohan,
In Umbraco 7, there is a razor code snippet for a login funtionallty it´s called Login this will gives you a login form, with validation too. Here is also a video chapter on Umbraco TV, how to work with public access. http://umbraco.tv/videos/umbraco-v7/content-editor/administrative-content/members/role-based-protection/
Hope this helps,
/Dennis
Hi, Rohan.
Umbraco provides a macro snippet that should do most of the work, you just need to make it available.
In the Umbraco Backoffice under the Developer section, right click on Partial View Macro Files and select Create. Give the new macro partial a name and select the Login snippet. This will create a new cshtml file in your solution with most of the login logic in place. You will now have to create a Macro that links to this file and takes a redirectUrl parameter of type Content Picker. Embed this macro into the richtext editor of any page and you now have your login for Public Access.
To get this to work for me, I had to make a slight tweak to the login snippet. Add this underneath the declaration of loginModel:
Rohan, I think I missed a few steps here. Check out this other page that is discussing your issue in more detail: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/53836-Member-login-doesnt-redirect-to-protected-node-after-login?p=0#comment215926
I also encoutered this problem, I decide tol implement the mebership function via MVC,
@Dennis. The link you posted I don't have previlege to see the video. Is there any way I can watch the video?
Hi Michael,
Yes to be able to watch the video you need to subscribe to the Umbraco TV you can find the different plans here: http://umbraco.tv/plans-signup/
/Dennis
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.