Developer forum

Forum » CMS - Standard features » Page using PageViewModel and Extranet login form

Page using PageViewModel and Extranet login form

Lars Larsen
Lars Larsen
Reply

Hi

I want to setup an extranet in a DW v9.6.8 solution. Using the new permission model I have set up permissions to restrict access to the pages in the extranet. What do I have to do to get users not logged in get a login form when requesting pages in the extranet? I am using the PageViewModel in the master and page templates and right now I get the error "Object reference not set to in instance of an object" when a user not logged in requests an extranet page and the page hits a @Model.GetString("some variable") in the Razor code.


Replies

 
Nicolai Pedersen
Reply

Hi Lars

Simply test if the user has access:

if(!PageView.Current.IsCurrentUserAllowed){

@Model.GetLogonDialog()

}

Though I would recommend a redirect to a dedicated logon page.

BR Nicolai

 
Lars Larsen
Lars Larsen
Reply

Hi

OK, done that.
In the solution I have the option to set a login template (see attached screenshot). Is that option now obsolete if new permission model is activated? If so how do I get rid of it?

Capture.PNG
 
Nicolai Pedersen
Reply

Hi Lars

It is not related to the new permission model - it is related to the Layout type you use (Viewmodel or Template tags) and is also related to if the page is an item or is using paragraphs. 

It is not possible to disable.

BR Nicolai

 
Lars Larsen
Lars Larsen
Reply

Hi Nicolai

I thought the login template option had been buried since I couldn't make it work and since it doesn't appear on the Doc site:

Capture.PNG

 

You must be logged in to post in the forum