Page 1 of 1

Create Customer in Admin panel

Posted: Thu Mar 28, 2013 2:03 am
by ktalati
Hello,

I want to create customers from admin panel and that customers can also be able to login from site.

So when i'm creating customers from admin panel, the customers added successfully but when i'm trying to login with that customer, i'm unable to login as BLC_CUSTOMER table shows me null value in password field of the customer which i had added from admin panel.

So i'm unable to login with that customer as well as i had seen one another strange thing that, when i'm creating customer from admin panel it doesn't assign role to that customer.


So please help me, How can i add customer from admin panel so that customer can login from site as well and how can i assign user role to them.

Please Please Help me ....

Thanks in Advance

Re: Create Customer in Admin panel

Posted: Fri Apr 12, 2013 3:56 pm
by jefffischer
Normally, a customer created in the admin screen would need to go through the forgot password flow to assign a new password. If you want to set the password yourself in the admin, you'll need to change the admin behavior. This takes place in the add method of the CustomerCustomPersistenceHandler. You'll need to extend this class with your own add implementation

Look at this post on how to override the behavior of an existing custom persistence handler:

viewtopic.php?f=13&t=1747&p=4879#p4879

You also need to override the exclusion behavior on the password field of CustomerImpl. The best way for you to do this it with metadata overrides in your app context. Adding something like this to your app context would probably do the trick:

Code: Select all

<mo:override id="blMetadataOverrides">
        <mo:overrideItem ceilingEntity="org.broadleafcommerce.profile.core.domain.Customer">
            <mo:field name="password">
                <mo:property name="excluded" value="false"/>
                <mo:property name="explicitFieldType" value="PASSWORD"/>
                <mo:property name="friendlyName" value="Password"/>
            </mo:field>
        </mo:overrideItem>
</mo:override>