I have a requirement to have a login box on a website which is always shown in the right-hand column of the site. I have succesfully created a child action and can successfully login via the box. However once the user has logged in I need to be able to display a different view in this box (e.g. remove login fields and add a logged in message, a logout button and a my account link(. Can anyone provide me with some guidance on how I would achieve this?
I have a requirement to have a login box on a website which is always shown in the right-hand column of the site. I have succesfully created a child action and can successfully login via the box. However once the user has logged in I need to be able to display a different view in this box (e.g. remove login fields and add a logged in message, a logout button and a my account link(. Can anyone provide me with some guidance on how I would achieve this?
Cheers,
Graham
Hi
I have made some customer ID check in the catalogcontroller. I don´t know where you will make the code for determine if the user is logged in or not but I use the _workContext.CurrentCustomer.Id to check if a customer is logged in. If it's >0 then a customer is logged in. The ID is the id from first column in the customer list. I use it to determine if a customer is allowed to view and buy a customer specific product.
You need to use this class: HeaderLinksModel from Nop.Web class library.This class has a property called IsAuthenticated and within the view just call Model.IsAuthenticated. You need to be familiar with View Model architecture in order to combine multiple classes and properties into one big class that can be used accross your web app.
Talley Raleigh
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.