Liferay
While working in the Liferay DXP 7.1 environment, we often need to perform a certain action when a user logs in to the Liferay server. To achieve this, we need to programmatically perform some action when a user logs in. I have put together the steps which would help a Liferay practitioner perform that action and save the development time.
To give you a small example, suppose, we want to send an email notification to the admin when a user logs in to the Liferay server. By implementing the steps mentioned in this blog, the same can be achieved.
Prerequisites:
1) Java 1.8
It can be downloaded from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2) Liferay DXP 7.1 bundled with tomcat.
It can be downloaded from https://www.liferay.com/products/dxp/trial-download
3) Eclipse/Liferay Developer Studio (For reference here I am using eclipse toolbar)
Proceed with the following step by step procedure to create your Liferay DXP 7.1 CustomLoginAction action.
1) Once you are done with above-mentioned prerequisites and have completed basic Liferay Environment Setup, your screen should look like the below-mentioned image.
liferay development company services
2) In Eclipse select Liferay as your current perspective.
3) Go to File->New->Liferay Work Space Project and enter details as shown in the below image.
liferay development company services
4) Click Finish after entering details and your newly created Liferay workspace project structure should look like the image below.
liferay development company services
Once you’re done with the basic Liferay project workspace setup, you need to create a module containing your custom login action that could be deployed in your Liferay DXP Server later.
5) Right-click on CustomLoginAction project go to New->Liferay Module Project and enter details as shown below image.
liferay development company services
6) Again, click Finish after entering details and your newly created Liferay module project structure should look at something as shown in the below image.
liferay development company services
Once you’re ready with the deployable module you would need to implement some service class inside the module that would be responsible for your custom login desired action.
7) Again, right-click on DemoModule go to New->Liferay Component Class select Login Pre Action from the Component Class Template dropdown, and select Finish as shown in the below image.
liferay development company services
8) After selecting Finish, your screen should appear as shown in the below image.
liferay development company services
9) Now implement some custom post login action in your class Component section where it is mentioned pre property = {“key=login.events.pre”}, simply change it to {“key=login.events.post”} and your class should look as shown in the below image.
liferay development company services
Now you can deploy this module. Log in to your Liferay environment and you will be able to see your CustomLoginAction Service Class S.O.P in your console as shown in the below image.
liferay development company services
Empower your digital journey with our skilled Liferay developers. Elevate your platform today!
Contact NowThe technology has been a pioneer in speeding up the data analysis of customers for enterprises.
17 Jul 2024
Learn about Alfresco development and its benefits for businesses. Discover how leveraging Alfresco can enhance efficiency and collaboration.
17 Jul 2024
Mastering Alfresco Development: Essential Tips for Success in ECM Solutions” provides crucial insights and strategies for developers to excel in…
17 Jul 2024
401, One World West, Nr. Ambli T-Junction 200, S P Ring Road, Bopal, Ahmedabad, Gujarat 380058
Kemp House 160 City Road, London, United Kingdom EC1V 2NX
Nürnberger Str. 46 90579 Langenzenn Deutschland
Level 36 Riparian Plaza, 71 Eagle Street, Brisbane, QLD 4000
4411 Suwanee Dam road, Bld. 300 Ste. 350 Suwanee GA, 30024
Cube Work Space, 24 Hans Strijdom Avenue, Cape Town
B 503 Sama Tower, Sheikh Zayed Road, United Arab Emirates
34 Applegrove Ct. Brampton ON L6R 2Y8
We use cookies to improve your browsing experience.
OKAYThis website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.
Strictly Necessary Cookie should be enabled at all times so that we can save your preferences for cookie settings.
If you disable this cookie, we will not be able to save your preferences. This means that every time you visit this website you will need to enable or disable cookies again.